mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Johan Hovold <johan@kernel.org>
Cc: Oliver Neukum <oneukum@suse.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/3] USB: serial: return errors from break handling
Date: Tue, 6 Jun 2023 07:46:36 -0500	[thread overview]
Message-ID: <ZH8qrBBwcXH0eP8/@mail.minyard.net> (raw)
In-Reply-To: <ZH8a12ZYtA2RzEK_@hovoldconsulting.com>

On Tue, Jun 06, 2023 at 01:39:03PM +0200, Johan Hovold wrote:
> On Tue, Jun 06, 2023 at 01:18:19PM +0200, Oliver Neukum wrote:
> > 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).
> 
> > do you eventually want this to be done for all serial devices?
> > That is does cdc-acm need something like this patch?
> 
> Looks good to me. If this turns out to confuse userspace we may have to
> turn that -ENOTTY into 0 in the tty layer, but we can still use it to
> avoid the unnecessary wait to "disable" the break state.
> 
> > 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.

Yeah, when I asked for this, I didn't realize that no devices did this,
I thought it was a one-off with this device.  There is a distinct
possibility that this will break userland.  This sounds like a good
plan.

-corey

> > 
> > Signed-off-by: Oliver Neukum <oneukum@suse.com>
> 
> Acked-by: Johan Hovold <johan@kernel.org>
> 
> > ---
> >  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,

      reply	other threads:[~2023-06-06 12:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-04 12:35 Johan Hovold
2023-06-04 12:35 ` [PATCH v2 1/3] " Johan Hovold
2023-06-06 11:13   ` Oliver Neukum
2023-06-06 11:34     ` Johan Hovold
2023-06-04 12:35 ` [PATCH v2 2/3] USB: serial: cp210x: disable break signalling on CP2105 SCI Johan Hovold
2023-06-04 12:35 ` [PATCH v2 3/3] USB: serial: report unsupported break signalling Johan Hovold
2023-06-04 20:19 ` [PATCH v2 0/3] USB: serial: return errors from break handling Corey Minyard
2023-06-06 11:18 ` Oliver Neukum
2023-06-06 11:39   ` Johan Hovold
2023-06-06 12:46     ` Corey Minyard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZH8qrBBwcXH0eP8/@mail.minyard.net \
    --to=minyard@acm.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®