Re: [PATCH v2 0/3] USB: serial: return errors from break handling

Oliver Neukum
2023-06-06T11:18:27Z

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On 04.06.23 14:35, Johan Hovold wrote:
> This series starts returning errors from break handling and also uses
> that mechanism to report to user space when break signalling is not
> supported (e.g. when device or driver support is missing).

Hi,

do you eventually want this to be done for all serial devices?
That is does cdc-acm need something like this patch?

Regards
Oliver

[-- Attachment #2: 0001-usb-cdc-acm-return-correct-error-code-on-unsupported.patch --]
[-- Type: text/x-patch, Size: 960 bytes --]

From 16430d9f109f904b2bfbac6e43a939209b6c4bc7 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Tue, 6 Jun 2023 12:57:00 +0200
Subject: [PATCH] usb: cdc-acm: return correct error code on unsupported break

Return -ENOTTY if the device says that it doesn't support break
so that the upper layers get error reporting right.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/class/cdc-acm.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 11da5fb284d0..7751f5728716 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -892,6 +892,9 @@ static int acm_tty_break_ctl(struct tty_struct *tty, int state)
struct acm *acm = tty->driver_data;
int retval;

+ if (!(acm->ctrl_caps & USB_CDC_CAP_BRK))
+ return -ENOTTY;
+
retval = acm_send_break(acm, state ? 0xffff : 0);
if (retval < 0)
dev_dbg(&acm->control->dev,
--
2.40.1