summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/console.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 11:10:08 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 13:03:23 -0700
commitc17ee886976b64d29ea89ee5d87751438e26025b (patch)
tree0d690bf8518905ee4c3f51a1c5b0b65e6008ba14 /drivers/usb/serial/console.c
parent4dbd5a0961ff55cb8a7bce309dd5ef9b04090570 (diff)
tty-usb-console: Fix termios
Setting CFLAG bits is all well and good but you must sort out ispeed and ospeed properly. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial/console.c')
-rw-r--r--drivers/usb/serial/console.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 9a4cd0a932b3..7b74238ad1c7 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -81,39 +81,11 @@ static int usb_console_setup(struct console *co, char *options)
if (*s)
doflow = (*s++ == 'r');
}
+
+ /* Sane default */
+ if (baud == 0)
+ baud = 9600;
- /* build a cflag setting */
- switch (baud) {
- case 1200:
- cflag |= B1200;
- break;
- case 2400:
- cflag |= B2400;
- break;
- case 4800:
- cflag |= B4800;
- break;
- case 19200:
- cflag |= B19200;
- break;
- case 38400:
- cflag |= B38400;
- break;
- case 57600:
- cflag |= B57600;
- break;
- case 115200:
- cflag |= B115200;
- break;
- case 9600:
- default:
- cflag |= B9600;
- /*
- * Set this to a sane value to prevent a divide error
- */
- baud = 9600;
- break;
- }
switch (bits) {
case 7:
cflag |= CS7;
@@ -188,6 +160,7 @@ static int usb_console_setup(struct console *co, char *options)
if (serial->type->set_termios) {
termios->c_cflag = cflag;
+ tty_termios_encode_baud_rate(termios, baud, baud);
serial->type->set_termios(NULL, port, &dummy);
port->port.tty = NULL;