diff options
Diffstat (limited to 'drivers/usb/serial/zte_ev.c')
-rw-r--r-- | drivers/usb/serial/zte_ev.c | 58 |
1 files changed, 35 insertions, 23 deletions
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 | ||
281 | static const struct usb_device_id id_table[] = { | 275 | static 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 | }; |
289 | MODULE_DEVICE_TABLE(usb, id_table); | 301 | MODULE_DEVICE_TABLE(usb, id_table); |