diff options
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r-- | drivers/usb/serial/option.c | 148 |
1 files changed, 102 insertions, 46 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index a396fbbdc9c2..e4be2d442b1e 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -28,7 +28,7 @@ device features. */ -#define DRIVER_VERSION "v0.7.1" +#define DRIVER_VERSION "v0.7.2" #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" #define DRIVER_DESC "USB Driver for GSM modems" @@ -109,6 +109,22 @@ static int option_send_setup(struct usb_serial_port *port); #define HUAWEI_PRODUCT_E600 0x1001 #define HUAWEI_PRODUCT_E220 0x1003 #define HUAWEI_PRODUCT_E220BIS 0x1004 +#define HUAWEI_PRODUCT_E1401 0x1401 +#define HUAWEI_PRODUCT_E1403 0x1403 +#define HUAWEI_PRODUCT_E1405 0x1405 +#define HUAWEI_PRODUCT_E1406 0x1406 +#define HUAWEI_PRODUCT_E1408 0x1408 +#define HUAWEI_PRODUCT_E1409 0x1409 +#define HUAWEI_PRODUCT_E1410 0x1410 +#define HUAWEI_PRODUCT_E1411 0x1411 +#define HUAWEI_PRODUCT_E1412 0x1412 +#define HUAWEI_PRODUCT_E1413 0x1413 +#define HUAWEI_PRODUCT_E1414 0x1414 +#define HUAWEI_PRODUCT_E1415 0x1415 +#define HUAWEI_PRODUCT_E1416 0x1416 +#define HUAWEI_PRODUCT_E1417 0x1417 +#define HUAWEI_PRODUCT_E1418 0x1418 +#define HUAWEI_PRODUCT_E1419 0x1419 #define NOVATELWIRELESS_VENDOR_ID 0x1410 @@ -129,6 +145,7 @@ static int option_send_setup(struct usb_serial_port *port); #define NOVATELWIRELESS_PRODUCT_EV620 0x2100 #define NOVATELWIRELESS_PRODUCT_ES720 0x2110 #define NOVATELWIRELESS_PRODUCT_E725 0x2120 +#define NOVATELWIRELESS_PRODUCT_ES620 0x2130 #define NOVATELWIRELESS_PRODUCT_EU730 0x2400 #define NOVATELWIRELESS_PRODUCT_EU740 0x2410 #define NOVATELWIRELESS_PRODUCT_EU870D 0x2420 @@ -137,6 +154,8 @@ static int option_send_setup(struct usb_serial_port *port); #define NOVATELWIRELESS_PRODUCT_MC727 0x4100 #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 +#define NOVATELWIRELESS_PRODUCT_U727 0x5010 + /* FUTURE NOVATEL PRODUCTS */ #define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000 #define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000 @@ -147,6 +166,12 @@ static int option_send_setup(struct usb_serial_port *port); #define NOVATELWIRELESS_PRODUCT_EMBEDDED_2 0x8001 #define NOVATELWIRELESS_PRODUCT_GLOBAL_2 0x9001 +/* AMOI PRODUCTS */ +#define AMOI_VENDOR_ID 0x1614 +#define AMOI_PRODUCT_H01 0x0800 +#define AMOI_PRODUCT_H01A 0x7002 +#define AMOI_PRODUCT_H02 0x0802 + #define DELL_VENDOR_ID 0x413C #define KYOCERA_VENDOR_ID 0x0c88 @@ -163,8 +188,13 @@ static int option_send_setup(struct usb_serial_port *port); #define BANDRICH_PRODUCT_C100_1 0x1002 #define BANDRICH_PRODUCT_C100_2 0x1003 +#define AMOI_VENDOR_ID 0x1614 +#define AMOI_PRODUCT_9508 0x0800 + #define QUALCOMM_VENDOR_ID 0x05C6 +#define MAXON_VENDOR_ID 0x16d8 + static struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, @@ -204,6 +234,23 @@ static struct usb_device_id option_ids[] = { { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418) }, + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419) }, + { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, /* Novatel Merlin EX720/V740/X720 */ @@ -216,13 +263,13 @@ static struct usb_device_id option_ids[] = { { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, /* Novatel EV620/ES620 CDMA/EV-DO */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, /* Novatel ES620/ES720/U720/USB720 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, /* Novatel E725/E726 */ - { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES620) }, /* Novatel Merlin ES620 SM Bus */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, /* Novatel EU730 and Vodafone EU740 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, /* Novatel non-Vodafone EU740 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ - { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x5010) }, /* Novatel U727 */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel U727 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */ @@ -232,6 +279,10 @@ static struct usb_device_id option_ids[] = { { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */ + { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, + { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, + { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) }, + { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ @@ -249,6 +300,7 @@ static struct usb_device_id option_ids[] = { { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ + { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, option_ids); @@ -273,9 +325,6 @@ static struct usb_serial_driver option_1port_device = { .description = "GSM modem (1-port)", .usb_driver = &option_driver, .id_table = option_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .open = option_open, .close = option_close, @@ -359,24 +408,24 @@ module_exit(option_exit); static void option_rx_throttle(struct usb_serial_port *port) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void option_rx_unthrottle(struct usb_serial_port *port) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void option_break_ctl(struct usb_serial_port *port, int break_state) { /* Unfortunately, I don't know how to send a break */ - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void option_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Doesn't support option setting */ tty_termios_copy_hw(port->tty->termios, old_termios); option_send_setup(port); @@ -406,6 +455,7 @@ static int option_tiocmset(struct usb_serial_port *port, struct file *file, portdata = usb_get_serial_port_data(port); + /* FIXME: what locks portdata fields ? */ if (set & TIOCM_RTS) portdata->rts_state = 1; if (set & TIOCM_DTR) @@ -436,7 +486,7 @@ static int option_write(struct usb_serial_port *port, portdata = usb_get_serial_port_data(port); - dbg("%s: write (%d chars)", __FUNCTION__, count); + dbg("%s: write (%d chars)", __func__, count); i = 0; left = count; @@ -457,7 +507,7 @@ static int option_write(struct usb_serial_port *port, dbg("usb_write %p failed (err=%d)", this_urb, this_urb->status); - dbg("%s: endpoint %d buf %d", __FUNCTION__, + dbg("%s: endpoint %d buf %d", __func__, usb_pipeendpoint(this_urb->pipe), i); /* send the data */ @@ -479,7 +529,7 @@ static int option_write(struct usb_serial_port *port, } count -= left; - dbg("%s: wrote (did %d)", __FUNCTION__, count); + dbg("%s: wrote (did %d)", __func__, count); return count; } @@ -492,14 +542,14 @@ static void option_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg("%s: %p", __FUNCTION__, urb); + dbg("%s: %p", __func__, urb); endpoint = usb_pipeendpoint(urb->pipe); - port = (struct usb_serial_port *) urb->context; + port = urb->context; if (status) { dbg("%s: nonzero status: %d on endpoint %02x.", - __FUNCTION__, status, endpoint); + __func__, status, endpoint); } else { tty = port->tty; if (urb->actual_length) { @@ -507,7 +557,7 @@ static void option_indat_callback(struct urb *urb) tty_insert_flip_string(tty, data, urb->actual_length); tty_flip_buffer_push(tty); } else { - dbg("%s: empty read urb received", __FUNCTION__); + dbg("%s: empty read urb received", __func__); } /* Resubmit urb so we continue receiving */ @@ -515,7 +565,7 @@ static void option_indat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err) printk(KERN_ERR "%s: resubmit read urb failed. " - "(%d)", __FUNCTION__, err); + "(%d)", __func__, err); } } return; @@ -527,9 +577,9 @@ static void option_outdat_callback(struct urb *urb) struct option_port_private *portdata; int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); - port = (struct usb_serial_port *) urb->context; + port = urb->context; usb_serial_port_softint(port); @@ -547,19 +597,19 @@ static void option_instat_callback(struct urb *urb) { int err; int status = urb->status; - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct option_port_private *portdata = usb_get_serial_port_data(port); struct usb_serial *serial = port->serial; - dbg("%s", __FUNCTION__); - dbg("%s: urb %p port %p has data %p", __FUNCTION__,urb,port,portdata); + dbg("%s", __func__); + dbg("%s: urb %p port %p has data %p", __func__,urb,port,portdata); if (status == 0) { struct usb_ctrlrequest *req_pkt = (struct usb_ctrlrequest *)urb->transfer_buffer; if (!req_pkt) { - dbg("%s: NULL req_pkt\n", __FUNCTION__); + dbg("%s: NULL req_pkt\n", __func__); return; } if ((req_pkt->bRequestType == 0xA1) && @@ -569,7 +619,7 @@ static void option_instat_callback(struct urb *urb) urb->transfer_buffer + sizeof(struct usb_ctrlrequest)); - dbg("%s: signal x%x", __FUNCTION__, signals); + dbg("%s: signal x%x", __func__, signals); old_dcd_state = portdata->dcd_state; portdata->cts_state = 1; @@ -581,11 +631,11 @@ static void option_instat_callback(struct urb *urb) old_dcd_state && !portdata->dcd_state) tty_hangup(port->tty); } else { - dbg("%s: type %x req %x", __FUNCTION__, + dbg("%s: type %x req %x", __func__, req_pkt->bRequestType,req_pkt->bRequest); } } else - dbg("%s: error %d", __FUNCTION__, status); + dbg("%s: error %d", __func__, status); /* Resubmit urb so we continue receiving IRQ data */ if (status != -ESHUTDOWN) { @@ -593,7 +643,7 @@ static void option_instat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err) dbg("%s: resubmit intr urb failed. (%d)", - __FUNCTION__, err); + __func__, err); } } @@ -606,13 +656,14 @@ static int option_write_room(struct usb_serial_port *port) portdata = usb_get_serial_port_data(port); + for (i=0; i < N_OUT_URB; i++) { this_urb = portdata->out_urbs[i]; if (this_urb && !test_bit(i, &portdata->out_busy)) data_len += OUT_BUFLEN; } - dbg("%s: %d", __FUNCTION__, data_len); + dbg("%s: %d", __func__, data_len); return data_len; } @@ -627,10 +678,12 @@ static int option_chars_in_buffer(struct usb_serial_port *port) for (i=0; i < N_OUT_URB; i++) { this_urb = portdata->out_urbs[i]; + /* FIXME: This locking is insufficient as this_urb may + go unused during the test */ if (this_urb && test_bit(i, &portdata->out_busy)) data_len += this_urb->transfer_buffer_length; } - dbg("%s: %d", __FUNCTION__, data_len); + dbg("%s: %d", __func__, data_len); return data_len; } @@ -643,7 +696,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) portdata = usb_get_serial_port_data(port); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Set some sane defaults */ portdata->rts_state = 1; @@ -655,7 +708,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) if (! urb) continue; if (urb->dev != serial->dev) { - dbg("%s: dev %p != %p", __FUNCTION__, + dbg("%s: dev %p != %p", __func__, urb->dev, serial->dev); continue; } @@ -669,7 +722,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) err = usb_submit_urb(urb, GFP_KERNEL); if (err) { dbg("%s: submit urb %d failed (%d) %d", - __FUNCTION__, i, err, + __func__, i, err, urb->transfer_buffer_length); } } @@ -697,7 +750,7 @@ static void option_close(struct usb_serial_port *port, struct file *filp) struct usb_serial *serial = port->serial; struct option_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); portdata = usb_get_serial_port_data(port); portdata->rts_state = 0; @@ -730,7 +783,7 @@ static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint, urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ if (urb == NULL) { - dbg("%s: alloc for endpoint %d failed.", __FUNCTION__, endpoint); + dbg("%s: alloc for endpoint %d failed.", __func__, endpoint); return NULL; } @@ -749,7 +802,7 @@ static void option_setup_urbs(struct usb_serial *serial) struct usb_serial_port *port; struct option_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; @@ -771,15 +824,18 @@ static void option_setup_urbs(struct usb_serial *serial) } } + +/** send RTS/DTR state to the port. + * + * This is exactly the same as SET_CONTROL_LINE_STATE from the PSTN + * CDC. +*/ static int option_send_setup(struct usb_serial_port *port) { struct usb_serial *serial = port->serial; struct option_port_private *portdata; - - dbg("%s", __FUNCTION__); - - if (port->number != 0) - return 0; + int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; + dbg("%s", __func__); portdata = usb_get_serial_port_data(port); @@ -792,7 +848,7 @@ static int option_send_setup(struct usb_serial_port *port) return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), - 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); + 0x22,0x21,val,ifNum,NULL,0,USB_CTRL_SET_TIMEOUT); } return 0; @@ -805,7 +861,7 @@ static int option_startup(struct usb_serial *serial) struct option_port_private *portdata; u8 *buffer; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Now setup per port private data */ for (i = 0; i < serial->num_ports; i++) { @@ -813,7 +869,7 @@ static int option_startup(struct usb_serial *serial) portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); if (!portdata) { dbg("%s: kmalloc for option_port_private (%d) failed!.", - __FUNCTION__, i); + __func__, i); return (1); } @@ -838,7 +894,7 @@ static int option_startup(struct usb_serial *serial) err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (err) dbg("%s: submit irq_in urb failed %d", - __FUNCTION__, err); + __func__, err); } option_setup_urbs(serial); @@ -862,7 +918,7 @@ static void option_shutdown(struct usb_serial *serial) struct usb_serial_port *port; struct option_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Stop reading/writing urbs */ for (i = 0; i < serial->num_ports; ++i) { |