linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cdc-acm: acm_init: Set initial BAUD to B0
@ 2020-07-10  9:35 Joakim Tjernlund
  2020-07-10  9:54 ` Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Joakim Tjernlund @ 2020-07-10  9:35 UTC (permalink / raw)
  To: linux-usb @ vger . kernel . org; +Cc: Joakim Tjernlund, stable

BO will disable USB input until the device opens. This will
avoid garbage chars waiting flood the TTY. This mimics a real UART
device better.
For initial termios to reach USB core, USB driver has to be
registered before TTY driver.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: stable@vger.kernel.org
---

 I hope this change makes sense to you, if so I belive
 ttyUSB could do the same.

 drivers/usb/class/cdc-acm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 751f00285ee6..5680f71200e5 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1999,19 +1999,19 @@ static int __init acm_init(void)
 	acm_tty_driver->subtype = SERIAL_TYPE_NORMAL,
 	acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
 	acm_tty_driver->init_termios = tty_std_termios;
-	acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD |
+	acm_tty_driver->init_termios.c_cflag = B0 | CS8 | CREAD |
 								HUPCL | CLOCAL;
 	tty_set_operations(acm_tty_driver, &acm_ops);
 
-	retval = tty_register_driver(acm_tty_driver);
+	retval = usb_register(&acm_driver);
 	if (retval) {
 		put_tty_driver(acm_tty_driver);
 		return retval;
 	}
 
-	retval = usb_register(&acm_driver);
+	retval = tty_register_driver(acm_tty_driver);
 	if (retval) {
-		tty_unregister_driver(acm_tty_driver);
+		usb_deregister(&acm_driver);
 		put_tty_driver(acm_tty_driver);
 		return retval;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-07-14  9:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-10  9:35 [PATCH] cdc-acm: acm_init: Set initial BAUD to B0 Joakim Tjernlund
2020-07-10  9:54 ` Johan Hovold
2020-07-10 10:16   ` Joakim Tjernlund
2020-07-10 10:36     ` Greg KH
2020-07-10 10:48       ` Joakim Tjernlund
2020-07-10 12:37     ` Johan Hovold
2020-07-10 10:34 ` Greg KH
2020-07-10 10:40   ` Joakim Tjernlund
2020-07-10 10:46   ` Joakim Tjernlund
2020-07-10 12:41     ` Johan Hovold
2020-07-10 16:05       ` Joakim Tjernlund
2020-07-10 16:08         ` Joakim Tjernlund
2020-07-13 12:29         ` Johan Hovold
2020-07-13 10:08 ` Oliver Neukum
2020-07-13 20:26   ` Joakim Tjernlund
2020-07-14  7:02     ` Oliver Neukum
2020-07-14  9:06       ` Joakim Tjernlund

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).