aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/ark3116.c2
-rw-r--r--drivers/usb/serial/cypress_m8.c18
-rw-r--r--drivers/usb/serial/cypress_m8.h4
-rw-r--r--drivers/usb/serial/f81232.c8
-rw-r--r--drivers/usb/serial/iuu_phoenix.c4
-rw-r--r--drivers/usb/serial/keyspan.c10
-rw-r--r--drivers/usb/serial/mos7720.c25
-rw-r--r--drivers/usb/serial/mos7840.c35
-rw-r--r--drivers/usb/serial/option.c26
-rw-r--r--drivers/usb/serial/pl2303.c10
-rw-r--r--drivers/usb/serial/qcserial.c1
-rw-r--r--drivers/usb/serial/spcp8x5.c10
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c3
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.h4
-rw-r--r--drivers/usb/serial/usb-serial.c4
-rw-r--r--drivers/usb/serial/visor.c9
-rw-r--r--drivers/usb/serial/whiteheat.c2
-rw-r--r--drivers/usb/serial/zte_ev.c58
18 files changed, 137 insertions, 96 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 3b16118cbf62..40e7fd94646f 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -43,7 +43,7 @@
43#define DRIVER_NAME "ark3116" 43#define DRIVER_NAME "ark3116"
44 44
45/* usb timeout of 1 second */ 45/* usb timeout of 1 second */
46#define ARK_TIMEOUT (1*HZ) 46#define ARK_TIMEOUT 1000
47 47
48static const struct usb_device_id id_table[] = { 48static const struct usb_device_id id_table[] = {
49 { USB_DEVICE(0x6547, 0x0232) }, 49 { USB_DEVICE(0x6547, 0x0232) },
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index d341555d37d8..082120198f87 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -65,6 +65,7 @@ static const struct usb_device_id id_table_earthmate[] = {
65static const struct usb_device_id id_table_cyphidcomrs232[] = { 65static const struct usb_device_id id_table_cyphidcomrs232[] = {
66 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 66 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
67 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, 67 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
68 { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) },
68 { } /* Terminating entry */ 69 { } /* Terminating entry */
69}; 70};
70 71
@@ -78,6 +79,7 @@ static const struct usb_device_id id_table_combined[] = {
78 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, 79 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) },
79 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 80 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
80 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, 81 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
82 { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) },
81 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, 83 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) },
82 { } /* Terminating entry */ 84 { } /* Terminating entry */
83}; 85};
@@ -229,6 +231,12 @@ static struct usb_serial_driver * const serial_drivers[] = {
229 * Cypress serial helper functions 231 * Cypress serial helper functions
230 *****************************************************************************/ 232 *****************************************************************************/
231 233
234/* FRWD Dongle hidcom needs to skip reset and speed checks */
235static inline bool is_frwd(struct usb_device *dev)
236{
237 return ((le16_to_cpu(dev->descriptor.idVendor) == VENDOR_ID_FRWD) &&
238 (le16_to_cpu(dev->descriptor.idProduct) == PRODUCT_ID_CYPHIDCOM_FRWD));
239}
232 240
233static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) 241static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate)
234{ 242{
@@ -238,6 +246,10 @@ static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate)
238 if (unstable_bauds) 246 if (unstable_bauds)
239 return new_rate; 247 return new_rate;
240 248
249 /* FRWD Dongle uses 115200 bps */
250 if (is_frwd(port->serial->dev))
251 return new_rate;
252
241 /* 253 /*
242 * The general purpose firmware for the Cypress M8 allows for 254 * The general purpose firmware for the Cypress M8 allows for
243 * a maximum speed of 57600bps (I have no idea whether DeLorme 255 * a maximum speed of 57600bps (I have no idea whether DeLorme
@@ -448,7 +460,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port)
448 return -ENOMEM; 460 return -ENOMEM;
449 } 461 }
450 462
451 usb_reset_configuration(serial->dev); 463 /* Skip reset for FRWD device. It is a workaound:
464 device hangs if it receives SET_CONFIGURE in Configured
465 state. */
466 if (!is_frwd(serial->dev))
467 usb_reset_configuration(serial->dev);
452 468
453 priv->cmd_ctrl = 0; 469 priv->cmd_ctrl = 0;
454 priv->line_control = 0; 470 priv->line_control = 0;
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
index 67cf60826884..b461311a2ae7 100644
--- a/drivers/usb/serial/cypress_m8.h
+++ b/drivers/usb/serial/cypress_m8.h
@@ -24,6 +24,10 @@
24#define VENDOR_ID_CYPRESS 0x04b4 24#define VENDOR_ID_CYPRESS 0x04b4
25#define PRODUCT_ID_CYPHIDCOM 0x5500 25#define PRODUCT_ID_CYPHIDCOM 0x5500
26 26
27/* FRWD Dongle - a GPS sports watch */
28#define VENDOR_ID_FRWD 0x6737
29#define PRODUCT_ID_CYPHIDCOM_FRWD 0x0001
30
27/* Powercom UPS, chip CY7C63723 */ 31/* Powercom UPS, chip CY7C63723 */
28#define VENDOR_ID_POWERCOM 0x0d9f 32#define VENDOR_ID_POWERCOM 0x0d9f
29#define PRODUCT_ID_UPS 0x0002 33#define PRODUCT_ID_UPS 0x0002
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 090b411d893f..7d8dd5aad236 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -165,11 +165,12 @@ static void f81232_set_termios(struct tty_struct *tty,
165 /* FIXME - Stubbed out for now */ 165 /* FIXME - Stubbed out for now */
166 166
167 /* Don't change anything if nothing has changed */ 167 /* Don't change anything if nothing has changed */
168 if (!tty_termios_hw_change(&tty->termios, old_termios)) 168 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
169 return; 169 return;
170 170
171 /* Do the real work here... */ 171 /* Do the real work here... */
172 tty_termios_copy_hw(&tty->termios, old_termios); 172 if (old_termios)
173 tty_termios_copy_hw(&tty->termios, old_termios);
173} 174}
174 175
175static int f81232_tiocmget(struct tty_struct *tty) 176static int f81232_tiocmget(struct tty_struct *tty)
@@ -187,12 +188,11 @@ static int f81232_tiocmset(struct tty_struct *tty,
187 188
188static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) 189static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
189{ 190{
190 struct ktermios tmp_termios;
191 int result; 191 int result;
192 192
193 /* Setup termios */ 193 /* Setup termios */
194 if (tty) 194 if (tty)
195 f81232_set_termios(tty, port, &tmp_termios); 195 f81232_set_termios(tty, port, NULL);
196 196
197 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 197 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
198 if (result) { 198 if (result) {
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 9d74c278b7b5..790673e5faa7 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -287,7 +287,7 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
287 usb_bulk_msg(serial->dev, 287 usb_bulk_msg(serial->dev,
288 usb_sndbulkpipe(serial->dev, 288 usb_sndbulkpipe(serial->dev,
289 port->bulk_out_endpointAddress), buf, 289 port->bulk_out_endpointAddress), buf,
290 count, &actual, HZ * 1); 290 count, &actual, 1000);
291 291
292 if (status != IUU_OPERATION_OK) 292 if (status != IUU_OPERATION_OK)
293 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); 293 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
@@ -307,7 +307,7 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
307 usb_bulk_msg(serial->dev, 307 usb_bulk_msg(serial->dev,
308 usb_rcvbulkpipe(serial->dev, 308 usb_rcvbulkpipe(serial->dev,
309 port->bulk_in_endpointAddress), buf, 309 port->bulk_in_endpointAddress), buf,
310 count, &actual, HZ * 1); 310 count, &actual, 1000);
311 311
312 if (status != IUU_OPERATION_OK) 312 if (status != IUU_OPERATION_OK)
313 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); 313 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index eb30d7b01f36..3549d073df22 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1548,7 +1548,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1548 struct keyspan_serial_private *s_priv; 1548 struct keyspan_serial_private *s_priv;
1549 struct keyspan_port_private *p_priv; 1549 struct keyspan_port_private *p_priv;
1550 const struct keyspan_device_details *d_details; 1550 const struct keyspan_device_details *d_details;
1551 int outcont_urb;
1552 struct urb *this_urb; 1551 struct urb *this_urb;
1553 int device_port, err; 1552 int device_port, err;
1554 1553
@@ -1559,7 +1558,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1559 d_details = s_priv->device_details; 1558 d_details = s_priv->device_details;
1560 device_port = port->number - port->serial->minor; 1559 device_port = port->number - port->serial->minor;
1561 1560
1562 outcont_urb = d_details->outcont_endpoints[port->number];
1563 this_urb = p_priv->outcont_urb; 1561 this_urb = p_priv->outcont_urb;
1564 1562
1565 dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); 1563 dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
@@ -1685,14 +1683,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1685 err = usb_submit_urb(this_urb, GFP_ATOMIC); 1683 err = usb_submit_urb(this_urb, GFP_ATOMIC);
1686 if (err != 0) 1684 if (err != 0)
1687 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err); 1685 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
1688#if 0
1689 else {
1690 dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__
1691 outcont_urb, this_urb->transfer_buffer_length,
1692 usb_pipeendpoint(this_urb->pipe));
1693 }
1694#endif
1695
1696 return 0; 1686 return 0;
1697} 1687}
1698 1688
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index cc0e54345df9..f27c621a9297 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -40,7 +40,7 @@
40#define DRIVER_DESC "Moschip USB Serial Driver" 40#define DRIVER_DESC "Moschip USB Serial Driver"
41 41
42/* default urb timeout */ 42/* default urb timeout */
43#define MOS_WDR_TIMEOUT (HZ * 5) 43#define MOS_WDR_TIMEOUT 5000
44 44
45#define MOS_MAX_PORT 0x02 45#define MOS_MAX_PORT 0x02
46#define MOS_WRITE 0x0E 46#define MOS_WRITE 0x0E
@@ -227,11 +227,22 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum,
227 __u8 requesttype = (__u8)0xc0; 227 __u8 requesttype = (__u8)0xc0;
228 __u16 index = get_reg_index(reg); 228 __u16 index = get_reg_index(reg);
229 __u16 value = get_reg_value(reg, serial_portnum); 229 __u16 value = get_reg_value(reg, serial_portnum);
230 int status = usb_control_msg(usbdev, pipe, request, requesttype, value, 230 u8 *buf;
231 index, data, 1, MOS_WDR_TIMEOUT); 231 int status;
232 if (status < 0) 232
233 buf = kmalloc(1, GFP_KERNEL);
234 if (!buf)
235 return -ENOMEM;
236
237 status = usb_control_msg(usbdev, pipe, request, requesttype, value,
238 index, buf, 1, MOS_WDR_TIMEOUT);
239 if (status == 1)
240 *data = *buf;
241 else if (status < 0)
233 dev_err(&usbdev->dev, 242 dev_err(&usbdev->dev,
234 "mos7720: usb_control_msg() failed: %d", status); 243 "mos7720: usb_control_msg() failed: %d", status);
244 kfree(buf);
245
235 return status; 246 return status;
236} 247}
237 248
@@ -1618,7 +1629,7 @@ static void change_port_settings(struct tty_struct *tty,
1618 mos7720_port->shadowMCR |= (UART_MCR_XONANY); 1629 mos7720_port->shadowMCR |= (UART_MCR_XONANY);
1619 /* To set hardware flow control to the specified * 1630 /* To set hardware flow control to the specified *
1620 * serial port, in SP1/2_CONTROL_REG */ 1631 * serial port, in SP1/2_CONTROL_REG */
1621 if (port->number) 1632 if (port_number)
1622 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); 1633 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01);
1623 else 1634 else
1624 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); 1635 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02);
@@ -1927,7 +1938,7 @@ static int mos7720_startup(struct usb_serial *serial)
1927 1938
1928 /* setting configuration feature to one */ 1939 /* setting configuration feature to one */
1929 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 1940 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
1930 (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); 1941 (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000);
1931 1942
1932 /* start the interrupt urb */ 1943 /* start the interrupt urb */
1933 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); 1944 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL);
@@ -1970,7 +1981,7 @@ static void mos7720_release(struct usb_serial *serial)
1970 /* wait for synchronous usb calls to return */ 1981 /* wait for synchronous usb calls to return */
1971 if (mos_parport->msg_pending) 1982 if (mos_parport->msg_pending)
1972 wait_for_completion_timeout(&mos_parport->syncmsg_compl, 1983 wait_for_completion_timeout(&mos_parport->syncmsg_compl,
1973 MOS_WDR_TIMEOUT); 1984 msecs_to_jiffies(MOS_WDR_TIMEOUT));
1974 1985
1975 parport_remove_port(mos_parport->pp); 1986 parport_remove_port(mos_parport->pp);
1976 usb_set_serial_data(serial, NULL); 1987 usb_set_serial_data(serial, NULL);
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a0d5ea545982..7e998081e1cd 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2142,13 +2142,21 @@ static int mos7840_ioctl(struct tty_struct *tty,
2142static int mos7810_check(struct usb_serial *serial) 2142static int mos7810_check(struct usb_serial *serial)
2143{ 2143{
2144 int i, pass_count = 0; 2144 int i, pass_count = 0;
2145 u8 *buf;
2145 __u16 data = 0, mcr_data = 0; 2146 __u16 data = 0, mcr_data = 0;
2146 __u16 test_pattern = 0x55AA; 2147 __u16 test_pattern = 0x55AA;
2148 int res;
2149
2150 buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
2151 if (!buf)
2152 return 0; /* failed to identify 7810 */
2147 2153
2148 /* Store MCR setting */ 2154 /* Store MCR setting */
2149 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2155 res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
2150 MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, 2156 MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER,
2151 &mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); 2157 buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
2158 if (res == VENDOR_READ_LENGTH)
2159 mcr_data = *buf;
2152 2160
2153 for (i = 0; i < 16; i++) { 2161 for (i = 0; i < 16; i++) {
2154 /* Send the 1-bit test pattern out to MCS7810 test pin */ 2162 /* Send the 1-bit test pattern out to MCS7810 test pin */
@@ -2158,9 +2166,12 @@ static int mos7810_check(struct usb_serial *serial)
2158 MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); 2166 MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT);
2159 2167
2160 /* Read the test pattern back */ 2168 /* Read the test pattern back */
2161 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2169 res = usb_control_msg(serial->dev,
2162 MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, 2170 usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ,
2163 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); 2171 MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
2172 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
2173 if (res == VENDOR_READ_LENGTH)
2174 data = *buf;
2164 2175
2165 /* If this is a MCS7810 device, both test patterns must match */ 2176 /* If this is a MCS7810 device, both test patterns must match */
2166 if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) 2177 if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001)
@@ -2174,6 +2185,8 @@ static int mos7810_check(struct usb_serial *serial)
2174 MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, 2185 MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL,
2175 0, MOS_WDR_TIMEOUT); 2186 0, MOS_WDR_TIMEOUT);
2176 2187
2188 kfree(buf);
2189
2177 if (pass_count == 16) 2190 if (pass_count == 16)
2178 return 1; 2191 return 1;
2179 2192
@@ -2183,11 +2196,17 @@ static int mos7810_check(struct usb_serial *serial)
2183static int mos7840_calc_num_ports(struct usb_serial *serial) 2196static int mos7840_calc_num_ports(struct usb_serial *serial)
2184{ 2197{
2185 __u16 data = 0x00; 2198 __u16 data = 0x00;
2199 u8 *buf;
2186 int mos7840_num_ports; 2200 int mos7840_num_ports;
2187 2201
2188 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2202 buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
2189 MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, 2203 if (buf) {
2190 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); 2204 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
2205 MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
2206 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
2207 data = *buf;
2208 kfree(buf);
2209 }
2191 2210
2192 if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || 2211 if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 ||
2193 serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { 2212 serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) {
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 93d02bc4eb52..bd4323ddae1a 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -250,13 +250,7 @@ static void option_instat_callback(struct urb *urb);
250#define ZTE_PRODUCT_MF622 0x0001 250#define ZTE_PRODUCT_MF622 0x0001
251#define ZTE_PRODUCT_MF628 0x0015 251#define ZTE_PRODUCT_MF628 0x0015
252#define ZTE_PRODUCT_MF626 0x0031 252#define ZTE_PRODUCT_MF626 0x0031
253#define ZTE_PRODUCT_CDMA_TECH 0xfffe
254#define ZTE_PRODUCT_AC8710 0xfff1
255#define ZTE_PRODUCT_AC2726 0xfff5
256#define ZTE_PRODUCT_AC8710T 0xffff
257#define ZTE_PRODUCT_MC2718 0xffe8 253#define ZTE_PRODUCT_MC2718 0xffe8
258#define ZTE_PRODUCT_AD3812 0xffeb
259#define ZTE_PRODUCT_MC2716 0xffed
260 254
261#define BENQ_VENDOR_ID 0x04a5 255#define BENQ_VENDOR_ID 0x04a5
262#define BENQ_PRODUCT_H10 0x4068 256#define BENQ_PRODUCT_H10 0x4068
@@ -495,18 +489,10 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = {
495 .reserved = BIT(4), 489 .reserved = BIT(4),
496}; 490};
497 491
498static const struct option_blacklist_info zte_ad3812_z_blacklist = {
499 .sendsetup = BIT(0) | BIT(1) | BIT(2),
500};
501
502static const struct option_blacklist_info zte_mc2718_z_blacklist = { 492static const struct option_blacklist_info zte_mc2718_z_blacklist = {
503 .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), 493 .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
504}; 494};
505 495
506static const struct option_blacklist_info zte_mc2716_z_blacklist = {
507 .sendsetup = BIT(1) | BIT(2) | BIT(3),
508};
509
510static const struct option_blacklist_info huawei_cdc12_blacklist = { 496static const struct option_blacklist_info huawei_cdc12_blacklist = {
511 .reserved = BIT(1) | BIT(2), 497 .reserved = BIT(1) | BIT(2),
512}; 498};
@@ -593,6 +579,8 @@ static const struct usb_device_id option_ids[] = {
593 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 579 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
594 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), 580 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
595 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 581 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
582 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x14ac, 0xff, 0xff, 0xff), /* Huawei E1820 */
583 .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
596 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), 584 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff),
597 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 585 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
598 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) }, 586 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
@@ -797,7 +785,6 @@ static const struct usb_device_id option_ids[] = {
797 { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, 785 { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) },
798 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, 786 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) },
799 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, 787 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
800 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */
801 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ 788 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
802 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ 789 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
803 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ 790 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */
@@ -1199,16 +1186,9 @@ static const struct usb_device_id option_ids[] = {
1199 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), 1186 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff),
1200 .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, 1187 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1201 1188
1202 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 1189 /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */
1203 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1204 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1205 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
1206 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), 1190 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
1207 .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, 1191 .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
1208 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
1209 .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
1210 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
1211 .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
1212 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, 1192 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
1213 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, 1193 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
1214 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, 1194 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 7151659367a0..048cd44d51b1 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -284,7 +284,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
284 serial settings even to the same values as before. Thus 284 serial settings even to the same values as before. Thus
285 we actually need to filter in this specific case */ 285 we actually need to filter in this specific case */
286 286
287 if (!tty_termios_hw_change(&tty->termios, old_termios)) 287 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
288 return; 288 return;
289 289
290 cflag = tty->termios.c_cflag; 290 cflag = tty->termios.c_cflag;
@@ -293,7 +293,8 @@ static void pl2303_set_termios(struct tty_struct *tty,
293 if (!buf) { 293 if (!buf) {
294 dev_err(&port->dev, "%s - out of memory.\n", __func__); 294 dev_err(&port->dev, "%s - out of memory.\n", __func__);
295 /* Report back no change occurred */ 295 /* Report back no change occurred */
296 tty->termios = *old_termios; 296 if (old_termios)
297 tty->termios = *old_termios;
297 return; 298 return;
298 } 299 }
299 300
@@ -433,7 +434,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
433 control = priv->line_control; 434 control = priv->line_control;
434 if ((cflag & CBAUD) == B0) 435 if ((cflag & CBAUD) == B0)
435 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); 436 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
436 else if ((old_termios->c_cflag & CBAUD) == B0) 437 else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
437 priv->line_control |= (CONTROL_DTR | CONTROL_RTS); 438 priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
438 if (control != priv->line_control) { 439 if (control != priv->line_control) {
439 control = priv->line_control; 440 control = priv->line_control;
@@ -492,7 +493,6 @@ static void pl2303_close(struct usb_serial_port *port)
492 493
493static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) 494static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
494{ 495{
495 struct ktermios tmp_termios;
496 struct usb_serial *serial = port->serial; 496 struct usb_serial *serial = port->serial;
497 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); 497 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
498 int result; 498 int result;
@@ -508,7 +508,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
508 508
509 /* Setup termios */ 509 /* Setup termios */
510 if (tty) 510 if (tty)
511 pl2303_set_termios(tty, port, &tmp_termios); 511 pl2303_set_termios(tty, port, NULL);
512 512
513 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 513 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
514 if (result) { 514 if (result) {
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 59b32b782126..bd794b43898c 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -118,6 +118,7 @@ static const struct usb_device_id id_table[] = {
118 {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ 118 {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
119 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ 119 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */
120 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ 120 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */
121 {USB_DEVICE(0x0AF0, 0x8120)}, /* Option GTM681W */
121 122
122 /* non Gobi Qualcomm serial devices */ 123 /* non Gobi Qualcomm serial devices */
123 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */ 124 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index cf3df793c2b7..ddf6c47137dc 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -291,7 +291,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
291 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 291 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
292 unsigned long flags; 292 unsigned long flags;
293 unsigned int cflag = tty->termios.c_cflag; 293 unsigned int cflag = tty->termios.c_cflag;
294 unsigned int old_cflag = old_termios->c_cflag;
295 unsigned short uartdata; 294 unsigned short uartdata;
296 unsigned char buf[2] = {0, 0}; 295 unsigned char buf[2] = {0, 0};
297 int baud; 296 int baud;
@@ -299,15 +298,15 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
299 u8 control; 298 u8 control;
300 299
301 /* check that they really want us to change something */ 300 /* check that they really want us to change something */
302 if (!tty_termios_hw_change(&tty->termios, old_termios)) 301 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
303 return; 302 return;
304 303
305 /* set DTR/RTS active */ 304 /* set DTR/RTS active */
306 spin_lock_irqsave(&priv->lock, flags); 305 spin_lock_irqsave(&priv->lock, flags);
307 control = priv->line_control; 306 control = priv->line_control;
308 if ((old_cflag & CBAUD) == B0) { 307 if (old_termios && (old_termios->c_cflag & CBAUD) == B0) {
309 priv->line_control |= MCR_DTR; 308 priv->line_control |= MCR_DTR;
310 if (!(old_cflag & CRTSCTS)) 309 if (!(old_termios->c_cflag & CRTSCTS))
311 priv->line_control |= MCR_RTS; 310 priv->line_control |= MCR_RTS;
312 } 311 }
313 if (control != priv->line_control) { 312 if (control != priv->line_control) {
@@ -394,7 +393,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
394 393
395static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) 394static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
396{ 395{
397 struct ktermios tmp_termios;
398 struct usb_serial *serial = port->serial; 396 struct usb_serial *serial = port->serial;
399 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 397 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
400 int ret; 398 int ret;
@@ -411,7 +409,7 @@ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
411 spcp8x5_set_ctrl_line(port, priv->line_control); 409 spcp8x5_set_ctrl_line(port, priv->line_control);
412 410
413 if (tty) 411 if (tty)
414 spcp8x5_set_termios(tty, port, &tmp_termios); 412 spcp8x5_set_termios(tty, port, NULL);
415 413
416 port->port.drain_delay = 256; 414 port->port.drain_delay = 256;
417 415
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index c92c5ed4e580..e581c2549a57 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -172,7 +172,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
172 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 172 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
173 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 173 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
174 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 174 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
175 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, 175 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) },
176 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
176 { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, 177 { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
177}; 178};
178 179
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index b353e7e3d480..4a2423e84d55 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -52,7 +52,9 @@
52 52
53/* Abbott Diabetics vendor and product ids */ 53/* Abbott Diabetics vendor and product ids */
54#define ABBOTT_VENDOR_ID 0x1a61 54#define ABBOTT_VENDOR_ID 0x1a61
55#define ABBOTT_PRODUCT_ID 0x3410 55#define ABBOTT_STEREO_PLUG_ID 0x3410
56#define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID
57#define ABBOTT_STRIP_PORT_ID 0x3420
56 58
57/* Commands */ 59/* Commands */
58#define TI_GET_VERSION 0x01 60#define TI_GET_VERSION 0x01
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 4753c005cfb6..5f6b1ff9d29e 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -408,7 +408,7 @@ static int serial_ioctl(struct tty_struct *tty,
408 unsigned int cmd, unsigned long arg) 408 unsigned int cmd, unsigned long arg)
409{ 409{
410 struct usb_serial_port *port = tty->driver_data; 410 struct usb_serial_port *port = tty->driver_data;
411 int retval = -ENODEV; 411 int retval = -ENOIOCTLCMD;
412 412
413 dev_dbg(tty->dev, "%s - cmd 0x%.4x\n", __func__, cmd); 413 dev_dbg(tty->dev, "%s - cmd 0x%.4x\n", __func__, cmd);
414 414
@@ -420,8 +420,6 @@ static int serial_ioctl(struct tty_struct *tty,
420 default: 420 default:
421 if (port->serial->type->ioctl) 421 if (port->serial->type->ioctl)
422 retval = port->serial->type->ioctl(tty, cmd, arg); 422 retval = port->serial->type->ioctl(tty, cmd, arg);
423 else
424 retval = -ENOIOCTLCMD;
425 } 423 }
426 424
427 return retval; 425 return retval;
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 7573ec8a084f..9910aa2edf4b 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -560,10 +560,19 @@ static int treo_attach(struct usb_serial *serial)
560 */ 560 */
561#define COPY_PORT(dest, src) \ 561#define COPY_PORT(dest, src) \
562 do { \ 562 do { \
563 int i; \
564 \
565 for (i = 0; i < ARRAY_SIZE(src->read_urbs); ++i) { \
566 dest->read_urbs[i] = src->read_urbs[i]; \
567 dest->read_urbs[i]->context = dest; \
568 dest->bulk_in_buffers[i] = src->bulk_in_buffers[i]; \
569 } \
563 dest->read_urb = src->read_urb; \ 570 dest->read_urb = src->read_urb; \
564 dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\ 571 dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\
565 dest->bulk_in_buffer = src->bulk_in_buffer; \ 572 dest->bulk_in_buffer = src->bulk_in_buffer; \
573 dest->bulk_in_size = src->bulk_in_size; \
566 dest->interrupt_in_urb = src->interrupt_in_urb; \ 574 dest->interrupt_in_urb = src->interrupt_in_urb; \
575 dest->interrupt_in_urb->context = dest; \
567 dest->interrupt_in_endpointAddress = \ 576 dest->interrupt_in_endpointAddress = \
568 src->interrupt_in_endpointAddress;\ 577 src->interrupt_in_endpointAddress;\
569 dest->interrupt_in_buffer = src->interrupt_in_buffer; \ 578 dest->interrupt_in_buffer = src->interrupt_in_buffer; \
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index b9fca3586d74..347caad47a12 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_struct *tty)
649 struct whiteheat_port_settings port_settings; 649 struct whiteheat_port_settings port_settings;
650 unsigned int cflag = tty->termios.c_cflag; 650 unsigned int cflag = tty->termios.c_cflag;
651 651
652 port_settings.port = port->number + 1; 652 port_settings.port = port->number - port->serial->minor + 1;
653 653
654 /* get the byte size */ 654 /* get the byte size */
655 switch (cflag & CSIZE) { 655 switch (cflag & CSIZE) {
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c
index 39ee7373b4ee..fca4c752a4ed 100644
--- a/drivers/usb/serial/zte_ev.c
+++ b/drivers/usb/serial/zte_ev.c
@@ -41,9 +41,6 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
41 int len; 41 int len;
42 unsigned char *buf; 42 unsigned char *buf;
43 43
44 if (port->number != 0)
45 return -ENODEV;
46
47 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); 44 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
48 if (!buf) 45 if (!buf)
49 return -ENOMEM; 46 return -ENOMEM;
@@ -53,7 +50,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
53 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 50 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
54 0x22, 0x21, 51 0x22, 0x21,
55 0x0001, 0x0000, NULL, len, 52 0x0001, 0x0000, NULL, len,
56 HZ * USB_CTRL_GET_TIMEOUT); 53 USB_CTRL_GET_TIMEOUT);
57 dev_dbg(dev, "result = %d\n", result); 54 dev_dbg(dev, "result = %d\n", result);
58 55
59 /* send 2st cmd and recieve data */ 56 /* send 2st cmd and recieve data */
@@ -65,7 +62,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
65 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 62 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
66 0x21, 0xa1, 63 0x21, 0xa1,
67 0x0000, 0x0000, buf, len, 64 0x0000, 0x0000, buf, len,
68 HZ * USB_CTRL_GET_TIMEOUT); 65 USB_CTRL_GET_TIMEOUT);
69 debug_data(dev, __func__, len, buf, result); 66 debug_data(dev, __func__, len, buf, result);
70 67
71 /* send 3 cmd */ 68 /* send 3 cmd */
@@ -84,7 +81,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
84 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 81 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
85 0x20, 0x21, 82 0x20, 0x21,
86 0x0000, 0x0000, buf, len, 83 0x0000, 0x0000, buf, len,
87 HZ * USB_CTRL_GET_TIMEOUT); 84 USB_CTRL_GET_TIMEOUT);
88 debug_data(dev, __func__, len, buf, result); 85 debug_data(dev, __func__, len, buf, result);
89 86
90 /* send 4 cmd */ 87 /* send 4 cmd */
@@ -95,7 +92,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
95 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 92 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
96 0x22, 0x21, 93 0x22, 0x21,
97 0x0003, 0x0000, NULL, len, 94 0x0003, 0x0000, NULL, len,
98 HZ * USB_CTRL_GET_TIMEOUT); 95 USB_CTRL_GET_TIMEOUT);
99 dev_dbg(dev, "result = %d\n", result); 96 dev_dbg(dev, "result = %d\n", result);
100 97
101 /* send 5 cmd */ 98 /* send 5 cmd */
@@ -107,7 +104,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
107 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 104 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
108 0x21, 0xa1, 105 0x21, 0xa1,
109 0x0000, 0x0000, buf, len, 106 0x0000, 0x0000, buf, len,
110 HZ * USB_CTRL_GET_TIMEOUT); 107 USB_CTRL_GET_TIMEOUT);
111 debug_data(dev, __func__, len, buf, result); 108 debug_data(dev, __func__, len, buf, result);
112 109
113 /* send 6 cmd */ 110 /* send 6 cmd */
@@ -126,7 +123,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
126 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 123 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
127 0x20, 0x21, 124 0x20, 0x21,
128 0x0000, 0x0000, buf, len, 125 0x0000, 0x0000, buf, len,
129 HZ * USB_CTRL_GET_TIMEOUT); 126 USB_CTRL_GET_TIMEOUT);
130 debug_data(dev, __func__, len, buf, result); 127 debug_data(dev, __func__, len, buf, result);
131 kfree(buf); 128 kfree(buf);
132 129
@@ -166,9 +163,6 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
166 int len; 163 int len;
167 unsigned char *buf; 164 unsigned char *buf;
168 165
169 if (port->number != 0)
170 return;
171
172 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); 166 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
173 if (!buf) 167 if (!buf)
174 return; 168 return;
@@ -178,7 +172,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
178 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 172 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
179 0x22, 0x21, 173 0x22, 0x21,
180 0x0002, 0x0000, NULL, len, 174 0x0002, 0x0000, NULL, len,
181 HZ * USB_CTRL_GET_TIMEOUT); 175 USB_CTRL_GET_TIMEOUT);
182 dev_dbg(dev, "result = %d\n", result); 176 dev_dbg(dev, "result = %d\n", result);
183 177
184 /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */ 178 /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */
@@ -186,7 +180,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
186 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 180 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
187 0x22, 0x21, 181 0x22, 0x21,
188 0x0003, 0x0000, NULL, len, 182 0x0003, 0x0000, NULL, len,
189 HZ * USB_CTRL_GET_TIMEOUT); 183 USB_CTRL_GET_TIMEOUT);
190 dev_dbg(dev, "result = %d\n", result); 184 dev_dbg(dev, "result = %d\n", result);
191 185
192 /* send 3st cmd and recieve data */ 186 /* send 3st cmd and recieve data */
@@ -198,7 +192,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
198 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 192 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
199 0x21, 0xa1, 193 0x21, 0xa1,
200 0x0000, 0x0000, buf, len, 194 0x0000, 0x0000, buf, len,
201 HZ * USB_CTRL_GET_TIMEOUT); 195 USB_CTRL_GET_TIMEOUT);
202 debug_data(dev, __func__, len, buf, result); 196 debug_data(dev, __func__, len, buf, result);
203 197
204 /* send 4 cmd */ 198 /* send 4 cmd */
@@ -217,7 +211,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
217 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 211 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
218 0x20, 0x21, 212 0x20, 0x21,
219 0x0000, 0x0000, buf, len, 213 0x0000, 0x0000, buf, len,
220 HZ * USB_CTRL_GET_TIMEOUT); 214 USB_CTRL_GET_TIMEOUT);
221 debug_data(dev, __func__, len, buf, result); 215 debug_data(dev, __func__, len, buf, result);
222 216
223 /* send 5 cmd */ 217 /* send 5 cmd */
@@ -228,7 +222,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
228 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 222 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
229 0x22, 0x21, 223 0x22, 0x21,
230 0x0003, 0x0000, NULL, len, 224 0x0003, 0x0000, NULL, len,
231 HZ * USB_CTRL_GET_TIMEOUT); 225 USB_CTRL_GET_TIMEOUT);
232 dev_dbg(dev, "result = %d\n", result); 226 dev_dbg(dev, "result = %d\n", result);
233 227
234 /* send 6 cmd */ 228 /* send 6 cmd */
@@ -240,7 +234,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
240 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 234 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
241 0x21, 0xa1, 235 0x21, 0xa1,
242 0x0000, 0x0000, buf, len, 236 0x0000, 0x0000, buf, len,
243 HZ * USB_CTRL_GET_TIMEOUT); 237 USB_CTRL_GET_TIMEOUT);
244 debug_data(dev, __func__, len, buf, result); 238 debug_data(dev, __func__, len, buf, result);
245 239
246 /* send 7 cmd */ 240 /* send 7 cmd */
@@ -259,7 +253,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
259 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 253 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
260 0x20, 0x21, 254 0x20, 0x21,
261 0x0000, 0x0000, buf, len, 255 0x0000, 0x0000, buf, len,
262 HZ * USB_CTRL_GET_TIMEOUT); 256 USB_CTRL_GET_TIMEOUT);
263 debug_data(dev, __func__, len, buf, result); 257 debug_data(dev, __func__, len, buf, result);
264 258
265 /* send 8 cmd */ 259 /* send 8 cmd */
@@ -270,7 +264,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
270 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 264 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
271 0x22, 0x21, 265 0x22, 0x21,
272 0x0003, 0x0000, NULL, len, 266 0x0003, 0x0000, NULL, len,
273 HZ * USB_CTRL_GET_TIMEOUT); 267 USB_CTRL_GET_TIMEOUT);
274 dev_dbg(dev, "result = %d\n", result); 268 dev_dbg(dev, "result = %d\n", result);
275 269
276 kfree(buf); 270 kfree(buf);
@@ -279,11 +273,29 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
279} 273}
280 274
281static const struct usb_device_id id_table[] = { 275static const struct usb_device_id id_table[] = {
282 { USB_DEVICE(0x19d2, 0xffff) }, /* AC8700 */ 276 /* AC8710, AC8710T */
283 { USB_DEVICE(0x19d2, 0xfffe) }, 277 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) },
284 { USB_DEVICE(0x19d2, 0xfffd) }, /* MG880 */ 278 /* AC8700 */
279 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) },
280 /* MG880 */
281 { USB_DEVICE(0x19d2, 0xfffd) },
282 { USB_DEVICE(0x19d2, 0xfffc) },
283 { USB_DEVICE(0x19d2, 0xfffb) },
284 /* AC2726, AC8710_V3 */
285 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) },
286 { USB_DEVICE(0x19d2, 0xfff6) },
287 { USB_DEVICE(0x19d2, 0xfff7) },
288 { USB_DEVICE(0x19d2, 0xfff8) },
289 { USB_DEVICE(0x19d2, 0xfff9) },
290 { USB_DEVICE(0x19d2, 0xffee) },
291 /* AC2716, MC2716 */
292 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) },
293 /* AD3812 */
294 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) },
295 { USB_DEVICE(0x19d2, 0xffec) },
285 { USB_DEVICE(0x05C6, 0x3197) }, 296 { USB_DEVICE(0x05C6, 0x3197) },
286 { USB_DEVICE(0x05C6, 0x6000) }, 297 { USB_DEVICE(0x05C6, 0x6000) },
298 { USB_DEVICE(0x05C6, 0x9008) },
287 { }, 299 { },
288}; 300};
289MODULE_DEVICE_TABLE(usb, id_table); 301MODULE_DEVICE_TABLE(usb, id_table);