linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] USB: cdc-acm: fix TIOCGSERIAL implementation
Date: Thu, 8 Apr 2021 11:48:56 +0200	[thread overview]
Message-ID: <YG7RiLoscS6VXG7n@hovoldconsulting.com> (raw)
In-Reply-To: <a1a94db2d373c4c7b8841908d8e6133ab022232e.camel@suse.com>

On Thu, Apr 08, 2021 at 10:36:46AM +0200, Oliver Neukum wrote:
> Am Mittwoch, den 07.04.2021, 12:28 +0200 schrieb Johan Hovold:
> > TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
> > serial devices is only useful for setting the close_delay and
> > closing_wait parameters.
> > 
> > The xmit_fifo_size parameter could be used to set the hardware transmit
> > fifo size of a legacy UART when it could not be detected, but the
> > interface is limited to eight bits and should be left unset when it is
> > not used.
> 
> OK.
> 
> > Similarly, baud_base could be used to set the uart base clock when it
> > could not be detected, but might as well be left unset when it is not
> > known.
> 
> Well, the devices report it. It is part of the standard.

No, the standard doesn't include anything about a baud-base clock
AFAICT.

> > Fix the cdc-acm TIOCGSERIAL implementation by dropping its custom
> > interpretation of the unused xmit_fifo_size and baud_base fields, which
> > overflowed the former with the URB buffer size and set the latter to the
> > current line speed. Also return the port line number, which is the only
> > other value used besides the close parameters.
> > 
> > Fixes: 18c75720e667 ("USB: allow users to run setserial with cdc-acm")
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/usb/class/cdc-acm.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> > index 43e31dad4831..b74713518b3a 100644
> > --- a/drivers/usb/class/cdc-acm.c
> > +++ b/drivers/usb/class/cdc-acm.c
> > @@ -929,8 +929,7 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
> >  {
> >  	struct acm *acm = tty->driver_data;
> >  
> > -	ss->xmit_fifo_size = acm->writesize;
> > -	ss->baud_base = le32_to_cpu(acm->line.dwDTERate);
> 
> If we do this, we have a value that can be set, but is not reported.
> That looks a bit strange to me.

Again, no, the baud_base cannot be set and it is unknown and unused.

The only reason to report back baud_base is to support the deprecated
ASYNC_SPD_CUST interface used to set a custom divisor. cdc-acm has never
supported that for obvious reasons.

Johan

  reply	other threads:[~2021-04-08  9:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 10:28 [PATCH 0/3] USB: cdc-acm: TIOCSSERIAL fixes Johan Hovold
2021-04-07 10:28 ` [PATCH 1/3] Revert "USB: cdc-acm: fix rounding error in TIOCSSERIAL" Johan Hovold
2021-04-07 11:04   ` Anthony Mallet
2021-04-07 11:25     ` Johan Hovold
2021-04-07 10:28 ` [PATCH 2/3] USB: cdc-acm: fix unprivileged TIOCCSERIAL Johan Hovold
2021-04-08  7:48   ` Oliver Neukum
2021-04-08  9:42     ` Johan Hovold
2021-04-08 11:35       ` Oliver Neukum
2021-04-07 10:28 ` [PATCH 3/3] USB: cdc-acm: fix TIOCGSERIAL implementation Johan Hovold
2021-04-08  8:36   ` Oliver Neukum
2021-04-08  9:48     ` Johan Hovold [this message]
2021-04-08 11:34       ` Oliver Neukum
2021-04-08 11:54         ` Johan Hovold
2021-04-08 11:59           ` Oliver Neukum
2021-04-08 12:07             ` Greg Kroah-Hartman

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=YG7RiLoscS6VXG7n@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.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;
as well as URLs for NNTP newsgroup(s).