diff options
author | Alan Cox <alan@redhat.com> | 2008-07-22 06:10:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:03:23 -0400 |
commit | c17ee886976b64d29ea89ee5d87751438e26025b (patch) | |
tree | 0d690bf8518905ee4c3f51a1c5b0b65e6008ba14 /drivers | |
parent | 4dbd5a0961ff55cb8a7bce309dd5ef9b04090570 (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')
-rw-r--r-- | drivers/usb/serial/console.c | 37 |
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) | |||
81 | if (*s) | 81 | if (*s) |
82 | doflow = (*s++ == 'r'); | 82 | doflow = (*s++ == 'r'); |
83 | } | 83 | } |
84 | |||
85 | /* Sane default */ | ||
86 | if (baud == 0) | ||
87 | baud = 9600; | ||
84 | 88 | ||
85 | /* build a cflag setting */ | ||
86 | switch (baud) { | ||
87 | case 1200: | ||
88 | cflag |= B1200; | ||
89 | break; | ||
90 | case 2400: | ||
91 | cflag |= B2400; | ||
92 | break; | ||
93 | case 4800: | ||
94 | cflag |= B4800; | ||
95 | break; | ||
96 | case 19200: | ||
97 | cflag |= B19200; | ||
98 | break; | ||
99 | case 38400: | ||
100 | cflag |= B38400; | ||
101 | break; | ||
102 | case 57600: | ||
103 | cflag |= B57600; | ||
104 | break; | ||
105 | case 115200: | ||
106 | cflag |= B115200; | ||
107 | break; | ||
108 | case 9600: | ||
109 | default: | ||
110 | cflag |= B9600; | ||
111 | /* | ||
112 | * Set this to a sane value to prevent a divide error | ||
113 | */ | ||
114 | baud = 9600; | ||
115 | break; | ||
116 | } | ||
117 | switch (bits) { | 89 | switch (bits) { |
118 | case 7: | 90 | case 7: |
119 | cflag |= CS7; | 91 | cflag |= CS7; |
@@ -188,6 +160,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
188 | 160 | ||
189 | if (serial->type->set_termios) { | 161 | if (serial->type->set_termios) { |
190 | termios->c_cflag = cflag; | 162 | termios->c_cflag = cflag; |
163 | tty_termios_encode_baud_rate(termios, baud, baud); | ||
191 | serial->type->set_termios(NULL, port, &dummy); | 164 | serial->type->set_termios(NULL, port, &dummy); |
192 | 165 | ||
193 | port->port.tty = NULL; | 166 | port->port.tty = NULL; |