aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/cypress_m8.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-02-10 21:23:24 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:37 -0400
commit3d6aa3206540e1e68bda9e8ea11ec71444f1ac71 (patch)
tree7c603f8d0944055bd12ab9815e58737cc92330d6 /drivers/usb/serial/cypress_m8.c
parent3416eaa1f8f8d516b77de514e14cf8da256d28fb (diff)
USB: cypress_m8: Don't issue GET_CONFIG for certain devices
Earthmate LT-20 devices (both "old" and "new" versions) can't tolerate a GET_CONFIG command. The original Earthmate has no trouble with this. Presumably other non-Earthmate devices are still OK as well. This change disables the use of GET_CONFIG for cases where it is known not to work. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/cypress_m8.c')
-rw-r--r--drivers/usb/serial/cypress_m8.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index c42d3bdbe98c..f0c5d2a7ab94 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -145,6 +145,7 @@ struct cypress_private {
145 __u8 current_config; /* stores the current configuration byte */ 145 __u8 current_config; /* stores the current configuration byte */
146 __u8 rx_flags; /* throttling - used from whiteheat/ftdi_sio */ 146 __u8 rx_flags; /* throttling - used from whiteheat/ftdi_sio */
147 enum packet_format pkt_fmt; /* format to use for packet send / receive */ 147 enum packet_format pkt_fmt; /* format to use for packet send / receive */
148 int get_cfg_unsafe; /* If true, the CYPRESS_GET_CONFIG is unsafe */
148 int baud_rate; /* stores current baud rate in integer form */ 149 int baud_rate; /* stores current baud rate in integer form */
149 int cbr_mask; /* stores current baud rate in masked form */ 150 int cbr_mask; /* stores current baud rate in masked form */
150 int isthrottled; /* if throttled, discard reads */ 151 int isthrottled; /* if throttled, discard reads */
@@ -401,6 +402,12 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m
401 } 402 }
402 break; 403 break;
403 case CYPRESS_GET_CONFIG: 404 case CYPRESS_GET_CONFIG:
405 if (priv->get_cfg_unsafe) {
406 /* Not implemented for this device,
407 and if we try to do it we're likely
408 to crash the hardware. */
409 return -ENOTTY;
410 }
404 dbg("%s - retreiving serial line settings", __FUNCTION__); 411 dbg("%s - retreiving serial line settings", __FUNCTION__);
405 /* set initial values in feature buffer */ 412 /* set initial values in feature buffer */
406 memset(feature_buffer, 0, sizeof(feature_buffer)); 413 memset(feature_buffer, 0, sizeof(feature_buffer));
@@ -570,20 +577,30 @@ static int generic_startup (struct usb_serial *serial)
570static int cypress_earthmate_startup (struct usb_serial *serial) 577static int cypress_earthmate_startup (struct usb_serial *serial)
571{ 578{
572 struct cypress_private *priv; 579 struct cypress_private *priv;
580 struct usb_serial_port *port = serial->port[0];
573 581
574 dbg("%s", __FUNCTION__); 582 dbg("%s", __FUNCTION__);
575 583
576 if (generic_startup(serial)) { 584 if (generic_startup(serial)) {
577 dbg("%s - Failed setting up port %d", __FUNCTION__, 585 dbg("%s - Failed setting up port %d", __FUNCTION__,
578 serial->port[0]->number); 586 port->number);
579 return 1; 587 return 1;
580 } 588 }
581 589
582 priv = usb_get_serial_port_data(serial->port[0]); 590 priv = usb_get_serial_port_data(port);
583 priv->chiptype = CT_EARTHMATE; 591 priv->chiptype = CT_EARTHMATE;
584 /* All Earthmate devices use the separated-count packet 592 /* All Earthmate devices use the separated-count packet
585 format! Idiotic. */ 593 format! Idiotic. */
586 priv->pkt_fmt = packet_format_1; 594 priv->pkt_fmt = packet_format_1;
595 if (serial->dev->descriptor.idProduct != PRODUCT_ID_EARTHMATEUSB) {
596 /* The old original USB Earthmate seemed able to
597 handle GET_CONFIG requests; everything they've
598 produced since that time crashes if this command is
599 attempted :-( */
600 dbg("%s - Marking this device as unsafe for GET_CONFIG "
601 "commands", __func__);
602 priv->get_cfg_unsafe = !0;
603 }
587 604
588 return 0; 605 return 0;
589} /* cypress_earthmate_startup */ 606} /* cypress_earthmate_startup */