aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/Kconfig10
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/option.c11
-rw-r--r--drivers/usb/serial/pl2303.c13
-rw-r--r--drivers/usb/serial/usb-serial-simple.c19
-rw-r--r--drivers/usb/serial/xsens_mt.c25
-rw-r--r--drivers/usb/serial/zte_ev.c305
7 files changed, 42 insertions, 342 deletions
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 3ce5c74b29e4..a69f7cd9d0bf 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -58,9 +58,11 @@ config USB_SERIAL_SIMPLE
58 handles a wide range of very simple devices, all in one 58 handles a wide range of very simple devices, all in one
59 driver. Specifically, it supports: 59 driver. Specifically, it supports:
60 - Suunto ANT+ USB device. 60 - Suunto ANT+ USB device.
61 - Medtronic CareLink USB device
61 - Fundamental Software dongle. 62 - Fundamental Software dongle.
62 - HP4x calculators 63 - HP4x calculators
63 - a number of Motorola phones 64 - a number of Motorola phones
65 - Novatel Wireless GPS receivers
64 - Siemens USB/MPI adapter. 66 - Siemens USB/MPI adapter.
65 - ViVOtech ViVOpay USB device. 67 - ViVOtech ViVOpay USB device.
66 - Infineon Modem Flashloader USB interface 68 - Infineon Modem Flashloader USB interface
@@ -682,14 +684,6 @@ config USB_SERIAL_WISHBONE
682 To compile this driver as a module, choose M here: the 684 To compile this driver as a module, choose M here: the
683 module will be called wishbone-serial. 685 module will be called wishbone-serial.
684 686
685config USB_SERIAL_ZTE
686 tristate "ZTE USB serial driver"
687 help
688 Say Y here if you want to use a ZTE USB to serial device.
689
690 To compile this driver as a module, choose M here: the
691 module will be called zte.
692
693config USB_SERIAL_SSU100 687config USB_SERIAL_SSU100
694 tristate "USB Quatech SSU-100 Single Port Serial Driver" 688 tristate "USB Quatech SSU-100 Single Port Serial Driver"
695 help 689 help
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index bfdafd349441..349d9df0895f 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -60,4 +60,3 @@ obj-$(CONFIG_USB_SERIAL_WISHBONE) += wishbone-serial.o
60obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o 60obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o
61obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o 61obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o
62obj-$(CONFIG_USB_SERIAL_XSENS_MT) += xsens_mt.o 62obj-$(CONFIG_USB_SERIAL_XSENS_MT) += xsens_mt.o
63obj-$(CONFIG_USB_SERIAL_ZTE) += zte_ev.o
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 54a8120897a6..d1a3f6044c8a 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -276,6 +276,7 @@ static void option_instat_callback(struct urb *urb);
276#define ZTE_PRODUCT_MF628 0x0015 276#define ZTE_PRODUCT_MF628 0x0015
277#define ZTE_PRODUCT_MF626 0x0031 277#define ZTE_PRODUCT_MF626 0x0031
278#define ZTE_PRODUCT_AC2726 0xfff1 278#define ZTE_PRODUCT_AC2726 0xfff1
279#define ZTE_PRODUCT_MG880 0xfffd
279#define ZTE_PRODUCT_CDMA_TECH 0xfffe 280#define ZTE_PRODUCT_CDMA_TECH 0xfffe
280#define ZTE_PRODUCT_AC8710T 0xffff 281#define ZTE_PRODUCT_AC8710T 0xffff
281#define ZTE_PRODUCT_MC2718 0xffe8 282#define ZTE_PRODUCT_MC2718 0xffe8
@@ -1560,7 +1561,15 @@ static const struct usb_device_id option_ids[] = {
1560 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) }, 1561 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) },
1561 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, 1562 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) },
1562 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, 1563 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) },
1563 1564 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffec, 0xff, 0xff, 0xff) },
1565 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffee, 0xff, 0xff, 0xff) },
1566 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff6, 0xff, 0xff, 0xff) },
1567 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff7, 0xff, 0xff, 0xff) },
1568 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff8, 0xff, 0xff, 0xff) },
1569 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff9, 0xff, 0xff, 0xff) },
1570 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfffb, 0xff, 0xff, 0xff) },
1571 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfffc, 0xff, 0xff, 0xff) },
1572 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MG880, 0xff, 0xff, 0xff) },
1564 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 1573 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
1565 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 1574 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1566 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, 1575 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index e9bad928039f..0f872e6b2c87 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -162,6 +162,9 @@ static const struct pl2303_type_data pl2303_type_data[TYPE_COUNT] = {
162 .max_baud_rate = 1228800, 162 .max_baud_rate = 1228800,
163 .quirks = PL2303_QUIRK_LEGACY, 163 .quirks = PL2303_QUIRK_LEGACY,
164 }, 164 },
165 [TYPE_HX] = {
166 .max_baud_rate = 12000000,
167 },
165}; 168};
166 169
167static int pl2303_vendor_read(struct usb_serial *serial, u16 value, 170static int pl2303_vendor_read(struct usb_serial *serial, u16 value,
@@ -395,16 +398,14 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty,
395 if (spriv->type->max_baud_rate) 398 if (spriv->type->max_baud_rate)
396 baud = min_t(speed_t, baud, spriv->type->max_baud_rate); 399 baud = min_t(speed_t, baud, spriv->type->max_baud_rate);
397 /* 400 /*
398 * Set baud rate to nearest supported value. 401 * Use direct method for supported baud rates, otherwise use divisors.
399 *
400 * NOTE: Baud rate 500k can only be set using divisors.
401 */ 402 */
402 baud_sup = pl2303_get_supported_baud_rate(baud); 403 baud_sup = pl2303_get_supported_baud_rate(baud);
403 404
404 if (baud == 500000) 405 if (baud == baud_sup)
405 baud = pl2303_encode_baud_rate_divisor(buf, baud); 406 baud = pl2303_encode_baud_rate_direct(buf, baud);
406 else 407 else
407 baud = pl2303_encode_baud_rate_direct(buf, baud_sup); 408 baud = pl2303_encode_baud_rate_divisor(buf, baud);
408 409
409 /* Save resulting baud rate */ 410 /* Save resulting baud rate */
410 tty_encode_baud_rate(tty, baud, baud); 411 tty_encode_baud_rate(tty, baud, baud);
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
index fb79775447b0..7064eb8d6142 100644
--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -20,7 +20,7 @@
20#include <linux/usb.h> 20#include <linux/usb.h>
21#include <linux/usb/serial.h> 21#include <linux/usb/serial.h>
22 22
23#define DEVICE(vendor, IDS) \ 23#define DEVICE_N(vendor, IDS, nport) \
24static const struct usb_device_id vendor##_id_table[] = { \ 24static const struct usb_device_id vendor##_id_table[] = { \
25 IDS(), \ 25 IDS(), \
26 { }, \ 26 { }, \
@@ -31,9 +31,15 @@ static struct usb_serial_driver vendor##_device = { \
31 .name = #vendor, \ 31 .name = #vendor, \
32 }, \ 32 }, \
33 .id_table = vendor##_id_table, \ 33 .id_table = vendor##_id_table, \
34 .num_ports = 1, \ 34 .num_ports = nport, \
35}; 35};
36 36
37#define DEVICE(vendor, IDS) DEVICE_N(vendor, IDS, 1)
38
39/* Medtronic CareLink USB driver */
40#define CARELINK_IDS() \
41 { USB_DEVICE(0x0a21, 0x8001) } /* MMT-7305WW */
42DEVICE(carelink, CARELINK_IDS);
37 43
38/* ZIO Motherboard USB driver */ 44/* ZIO Motherboard USB driver */
39#define ZIO_IDS() \ 45#define ZIO_IDS() \
@@ -64,6 +70,11 @@ DEVICE(vivopay, VIVOPAY_IDS);
64 { USB_DEVICE(0x22b8, 0x2c64) } /* Motorola V950 phone */ 70 { USB_DEVICE(0x22b8, 0x2c64) } /* Motorola V950 phone */
65DEVICE(moto_modem, MOTO_IDS); 71DEVICE(moto_modem, MOTO_IDS);
66 72
73/* Novatel Wireless GPS driver */
74#define NOVATEL_IDS() \
75 { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */
76DEVICE_N(novatel_gps, NOVATEL_IDS, 3);
77
67/* HP4x (48/49) Generic Serial driver */ 78/* HP4x (48/49) Generic Serial driver */
68#define HP4X_IDS() \ 79#define HP4X_IDS() \
69 { USB_DEVICE(0x03f0, 0x0121) } 80 { USB_DEVICE(0x03f0, 0x0121) }
@@ -82,11 +93,13 @@ DEVICE(siemens_mpi, SIEMENS_IDS);
82 93
83/* All of the above structures mushed into two lists */ 94/* All of the above structures mushed into two lists */
84static struct usb_serial_driver * const serial_drivers[] = { 95static struct usb_serial_driver * const serial_drivers[] = {
96 &carelink_device,
85 &zio_device, 97 &zio_device,
86 &funsoft_device, 98 &funsoft_device,
87 &flashloader_device, 99 &flashloader_device,
88 &vivopay_device, 100 &vivopay_device,
89 &moto_modem_device, 101 &moto_modem_device,
102 &novatel_gps_device,
90 &hp4x_device, 103 &hp4x_device,
91 &suunto_device, 104 &suunto_device,
92 &siemens_mpi_device, 105 &siemens_mpi_device,
@@ -94,11 +107,13 @@ static struct usb_serial_driver * const serial_drivers[] = {
94}; 107};
95 108
96static const struct usb_device_id id_table[] = { 109static const struct usb_device_id id_table[] = {
110 CARELINK_IDS(),
97 ZIO_IDS(), 111 ZIO_IDS(),
98 FUNSOFT_IDS(), 112 FUNSOFT_IDS(),
99 FLASHLOADER_IDS(), 113 FLASHLOADER_IDS(),
100 VIVOPAY_IDS(), 114 VIVOPAY_IDS(),
101 MOTO_IDS(), 115 MOTO_IDS(),
116 NOVATEL_IDS(),
102 HP4X_IDS(), 117 HP4X_IDS(),
103 SUUNTO_IDS(), 118 SUUNTO_IDS(),
104 SIEMENS_IDS(), 119 SIEMENS_IDS(),
diff --git a/drivers/usb/serial/xsens_mt.c b/drivers/usb/serial/xsens_mt.c
index 4841fb57400c..3837d5113bb2 100644
--- a/drivers/usb/serial/xsens_mt.c
+++ b/drivers/usb/serial/xsens_mt.c
@@ -41,28 +41,13 @@ static const struct usb_device_id id_table[] = {
41}; 41};
42MODULE_DEVICE_TABLE(usb, id_table); 42MODULE_DEVICE_TABLE(usb, id_table);
43 43
44static int has_required_endpoints(const struct usb_host_interface *interface)
45{
46 __u8 i;
47 int has_bulk_in = 0;
48 int has_bulk_out = 0;
49
50 for (i = 0; i < interface->desc.bNumEndpoints; ++i) {
51 if (usb_endpoint_is_bulk_in(&interface->endpoint[i].desc))
52 has_bulk_in = 1;
53 else if (usb_endpoint_is_bulk_out(&interface->endpoint[i].desc))
54 has_bulk_out = 1;
55 }
56
57 return has_bulk_in && has_bulk_out;
58}
59
60static int xsens_mt_probe(struct usb_serial *serial, 44static int xsens_mt_probe(struct usb_serial *serial,
61 const struct usb_device_id *id) 45 const struct usb_device_id *id)
62{ 46{
63 if (!has_required_endpoints(serial->interface->cur_altsetting)) 47 if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
64 return -ENODEV; 48 return 0;
65 return 0; 49
50 return -ENODEV;
66} 51}
67 52
68static struct usb_serial_driver xsens_mt_device = { 53static struct usb_serial_driver xsens_mt_device = {
@@ -82,4 +67,6 @@ static struct usb_serial_driver * const serial_drivers[] = {
82 67
83module_usb_serial_driver(serial_drivers, id_table); 68module_usb_serial_driver(serial_drivers, id_table);
84 69
70MODULE_AUTHOR("Frans Klaver <frans.klaver@xsens.com>");
71MODULE_DESCRIPTION("USB-serial driver for Xsens motion trackers");
85MODULE_LICENSE("GPL"); 72MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c
deleted file mode 100644
index c9bb107d5e5c..000000000000
--- a/drivers/usb/serial/zte_ev.c
+++ /dev/null
@@ -1,305 +0,0 @@
1/*
2 * ZTE_EV USB serial driver
3 *
4 * Copyright (C) 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 * Copyright (C) 2012 Linux Foundation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This driver is based on code found in a ZTE_ENV patch that modified
12 * the usb-serial generic driver. Comments were left in that I think
13 * show the commands used to talk to the device, but I am not sure.
14 */
15#include <linux/kernel.h>
16#include <linux/tty.h>
17#include <linux/slab.h>
18#include <linux/module.h>
19#include <linux/usb.h>
20#include <linux/usb/serial.h>
21#include <linux/uaccess.h>
22
23#define MAX_SETUP_DATA_SIZE 32
24
25static void debug_data(struct device *dev, const char *function, int len,
26 const unsigned char *data, int result)
27{
28 dev_dbg(dev, "result = %d\n", result);
29 if (result == len)
30 dev_dbg(dev, "%s - length = %d, data = %*ph\n", function,
31 len, len, data);
32}
33
34static int zte_ev_usb_serial_open(struct tty_struct *tty,
35 struct usb_serial_port *port)
36{
37 struct usb_device *udev = port->serial->dev;
38 struct device *dev = &port->dev;
39 int result = 0;
40 int len;
41 unsigned char *buf;
42
43 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
44 if (!buf)
45 return -ENOMEM;
46
47 /* send 1st ctl cmd(CTL 21 22 01 00 00 00 00 00) */
48 len = 0;
49 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
50 0x22, 0x21,
51 0x0001, 0x0000, NULL, len,
52 USB_CTRL_GET_TIMEOUT);
53 dev_dbg(dev, "result = %d\n", result);
54
55 /* send 2st cmd and receive data */
56 /*
57 * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 25.1.0(5)
58 * 16.0 DI 00 96 00 00 00 00 08
59 */
60 len = 0x0007;
61 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
62 0x21, 0xa1,
63 0x0000, 0x0000, buf, len,
64 USB_CTRL_GET_TIMEOUT);
65 debug_data(dev, __func__, len, buf, result);
66
67 /* send 3rd cmd */
68 /*
69 * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 30.1.0
70 * 16.0 DO 80 25 00 00 00 00 08 .%..... 30.2.0
71 */
72 len = 0x0007;
73 buf[0] = 0x80;
74 buf[1] = 0x25;
75 buf[2] = 0x00;
76 buf[3] = 0x00;
77 buf[4] = 0x00;
78 buf[5] = 0x00;
79 buf[6] = 0x08;
80 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
81 0x20, 0x21,
82 0x0000, 0x0000, buf, len,
83 USB_CTRL_GET_TIMEOUT);
84 debug_data(dev, __func__, len, buf, result);
85
86 /* send 4th cmd */
87 /*
88 * 16.0 CTL 21 22 03 00 00 00 00 00
89 */
90 len = 0;
91 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
92 0x22, 0x21,
93 0x0003, 0x0000, NULL, len,
94 USB_CTRL_GET_TIMEOUT);
95 dev_dbg(dev, "result = %d\n", result);
96
97 /* send 5th cmd */
98 /*
99 * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 33.1.0
100 * 16.0 DI 80 25 00 00 00 00 08
101 */
102 len = 0x0007;
103 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
104 0x21, 0xa1,
105 0x0000, 0x0000, buf, len,
106 USB_CTRL_GET_TIMEOUT);
107 debug_data(dev, __func__, len, buf, result);
108
109 /* send 6th cmd */
110 /*
111 * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 34.1.0
112 * 16.0 DO 80 25 00 00 00 00 08
113 */
114 len = 0x0007;
115 buf[0] = 0x80;
116 buf[1] = 0x25;
117 buf[2] = 0x00;
118 buf[3] = 0x00;
119 buf[4] = 0x00;
120 buf[5] = 0x00;
121 buf[6] = 0x08;
122 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
123 0x20, 0x21,
124 0x0000, 0x0000, buf, len,
125 USB_CTRL_GET_TIMEOUT);
126 debug_data(dev, __func__, len, buf, result);
127 kfree(buf);
128
129 return usb_serial_generic_open(tty, port);
130}
131
132/*
133 * CTL 21 22 02 00 00 00 00 00 CLASS 338.1.0
134 *
135 * 16.1 DI a1 20 00 00 00 00 02 00 02 00 . ........ 340.1.0
136 * 16.0 CTL 21 22 03 00 00 00 00 00 CLASS 341.1.0
137 *
138 * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 346.1.0(3)
139 * 16.0 DI 00 08 07 00 00 00 08 ....... 346.2.0
140 *
141 * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 349.1.0
142 * 16.0 DO 00 c2 01 00 00 00 08 ....... 349.2.0
143 *
144 * 16.0 CTL 21 22 03 00 00 00 00 00 CLASS 350.1.0(2)
145 *
146 * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 352.1.0
147 * 16.0 DI 00 c2 01 00 00 00 08 ....... 352.2.0
148 *
149 * 16.1 DI a1 20 00 00 00 00 02 00 02 00 . ........ 353.1.0
150 *
151 * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 354.1.0
152 * 16.0 DO 00 c2 01 00 00 00 08 ....... 354.2.0
153 *
154 * 16.0 CTL 21 22 03 00 00 00 00 00
155*/
156
157static void zte_ev_usb_serial_close(struct usb_serial_port *port)
158{
159 struct usb_device *udev = port->serial->dev;
160 struct device *dev = &port->dev;
161 int result = 0;
162 int len;
163 unsigned char *buf;
164
165 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
166 if (!buf)
167 return;
168
169 /* send 1st ctl cmd(CTL 21 22 02 00 00 00 00 00) */
170 len = 0;
171 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
172 0x22, 0x21,
173 0x0002, 0x0000, NULL, len,
174 USB_CTRL_GET_TIMEOUT);
175 dev_dbg(dev, "result = %d\n", result);
176
177 /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */
178 len = 0;
179 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
180 0x22, 0x21,
181 0x0003, 0x0000, NULL, len,
182 USB_CTRL_GET_TIMEOUT);
183 dev_dbg(dev, "result = %d\n", result);
184
185 /* send 3st cmd and recieve data */
186 /*
187 * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 25.1.0(5)
188 * 16.0 DI 00 08 07 00 00 00 08
189 */
190 len = 0x0007;
191 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
192 0x21, 0xa1,
193 0x0000, 0x0000, buf, len,
194 USB_CTRL_GET_TIMEOUT);
195 debug_data(dev, __func__, len, buf, result);
196
197 /* send 4th cmd */
198 /*
199 * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 30.1.0
200 * 16.0 DO 00 c2 01 00 00 00 08 .%..... 30.2.0
201 */
202 len = 0x0007;
203 buf[0] = 0x00;
204 buf[1] = 0xc2;
205 buf[2] = 0x01;
206 buf[3] = 0x00;
207 buf[4] = 0x00;
208 buf[5] = 0x00;
209 buf[6] = 0x08;
210 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
211 0x20, 0x21,
212 0x0000, 0x0000, buf, len,
213 USB_CTRL_GET_TIMEOUT);
214 debug_data(dev, __func__, len, buf, result);
215
216 /* send 5th cmd */
217 /*
218 * 16.0 CTL 21 22 03 00 00 00 00 00
219 */
220 len = 0;
221 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
222 0x22, 0x21,
223 0x0003, 0x0000, NULL, len,
224 USB_CTRL_GET_TIMEOUT);
225 dev_dbg(dev, "result = %d\n", result);
226
227 /* send 6th cmd */
228 /*
229 * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 33.1.0
230 * 16.0 DI 00 c2 01 00 00 00 08
231 */
232 len = 0x0007;
233 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
234 0x21, 0xa1,
235 0x0000, 0x0000, buf, len,
236 USB_CTRL_GET_TIMEOUT);
237 debug_data(dev, __func__, len, buf, result);
238
239 /* send 7th cmd */
240 /*
241 * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 354.1.0
242 * 16.0 DO 00 c2 01 00 00 00 08 ....... 354.2.0
243 */
244 len = 0x0007;
245 buf[0] = 0x00;
246 buf[1] = 0xc2;
247 buf[2] = 0x01;
248 buf[3] = 0x00;
249 buf[4] = 0x00;
250 buf[5] = 0x00;
251 buf[6] = 0x08;
252 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
253 0x20, 0x21,
254 0x0000, 0x0000, buf, len,
255 USB_CTRL_GET_TIMEOUT);
256 debug_data(dev, __func__, len, buf, result);
257
258 /* send 8th cmd */
259 /*
260 * 16.0 CTL 21 22 03 00 00 00 00 00
261 */
262 len = 0;
263 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
264 0x22, 0x21,
265 0x0003, 0x0000, NULL, len,
266 USB_CTRL_GET_TIMEOUT);
267 dev_dbg(dev, "result = %d\n", result);
268
269 kfree(buf);
270
271 usb_serial_generic_close(port);
272}
273
274static const struct usb_device_id id_table[] = {
275 { USB_DEVICE(0x19d2, 0xffec) },
276 { USB_DEVICE(0x19d2, 0xffee) },
277 { USB_DEVICE(0x19d2, 0xfff6) },
278 { USB_DEVICE(0x19d2, 0xfff7) },
279 { USB_DEVICE(0x19d2, 0xfff8) },
280 { USB_DEVICE(0x19d2, 0xfff9) },
281 { USB_DEVICE(0x19d2, 0xfffb) },
282 { USB_DEVICE(0x19d2, 0xfffc) },
283 /* MG880 */
284 { USB_DEVICE(0x19d2, 0xfffd) },
285 { },
286};
287MODULE_DEVICE_TABLE(usb, id_table);
288
289static struct usb_serial_driver zio_device = {
290 .driver = {
291 .owner = THIS_MODULE,
292 .name = "zte_ev",
293 },
294 .id_table = id_table,
295 .num_ports = 1,
296 .open = zte_ev_usb_serial_open,
297 .close = zte_ev_usb_serial_close,
298};
299
300static struct usb_serial_driver * const serial_drivers[] = {
301 &zio_device, NULL
302};
303
304module_usb_serial_driver(serial_drivers, id_table);
305MODULE_LICENSE("GPL v2");