Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

revert "keyspan: init termios properly"

Revert 7eea436433b7b18045f272562e256976f593f7c0.

Lucy said:

This patch will work with the 19HS but WILL BREAK all other Keyspan
adapters. It will take me a few days to get to looking at a correct fix but
that keyspan_send_setup(port, 1) (and the '1' is the important part) must
happen once when the port is first opened. The cflag can just be set to
whatever the normal default is for your serial environment.

So revert this again pending the proper fix.

Cc: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Greg KH <greg@kroah.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Lucy McCoy <lucy@keyspan.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrew Morton and committed by
Linus Torvalds
f78ba157 db573b24

+29 -3
+29 -3
drivers/usb/serial/keyspan.c
··· 1215 1215 1216 1216 static int keyspan_open (struct usb_serial_port *port, struct file *filp) 1217 1217 { 1218 - struct keyspan_port_private *p_priv; 1219 - struct keyspan_serial_private *s_priv; 1220 - struct usb_serial *serial = port->serial; 1218 + struct keyspan_port_private *p_priv; 1219 + struct keyspan_serial_private *s_priv; 1220 + struct usb_serial *serial = port->serial; 1221 1221 const struct keyspan_device_details *d_details; 1222 1222 int i, err; 1223 + int baud_rate, device_port; 1223 1224 struct urb *urb; 1225 + unsigned int cflag; 1224 1226 1225 1227 s_priv = usb_get_serial_data(serial); 1226 1228 p_priv = usb_get_serial_port_data(port); ··· 1264 1262 urb->dev = serial->dev; 1265 1263 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ 1266 1264 } 1265 + 1266 + /* get the terminal config for the setup message now so we don't 1267 + * need to send 2 of them */ 1268 + 1269 + cflag = port->tty->termios->c_cflag; 1270 + device_port = port->number - port->serial->minor; 1271 + 1272 + /* Baud rate calculation takes baud rate as an integer 1273 + so other rates can be generated if desired. */ 1274 + baud_rate = tty_get_baud_rate(port->tty); 1275 + /* If no match or invalid, leave as default */ 1276 + if (baud_rate >= 0 1277 + && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, 1278 + NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { 1279 + p_priv->baud = baud_rate; 1280 + } 1281 + 1282 + /* set CTS/RTS handshake etc. */ 1283 + p_priv->cflag = cflag; 1284 + p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; 1285 + 1286 + keyspan_send_setup(port, 1); 1287 + //mdelay(100); 1288 + //keyspan_set_termios(port, NULL); 1267 1289 1268 1290 return (0); 1269 1291 }