From 399aa9a75ad372b301e5050f3653a297a767fdc4 Mon Sep 17 00:00:00 2001 From: Lauri Hintsala Date: Wed, 13 Aug 2014 15:02:53 +0300 Subject: USB: pl2303: use divisors for unsupported baud rates Use direct method for supported baud rates, otherwise use divisors. Limit baud rate to 12 Mbaud with HX type. This change has been tested to work with PL-2303HX at 115200, 500000, 1000000, 2000000, 2500000, 3000000 and 4000000 baud rates. Signed-off-by: Lauri Hintsala Signed-off-by: Johan Hovold --- drivers/usb/serial/pl2303.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index e9bad92..0f872e6 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] = { .max_baud_rate = 1228800, .quirks = PL2303_QUIRK_LEGACY, }, + [TYPE_HX] = { + .max_baud_rate = 12000000, + }, }; static int pl2303_vendor_read(struct usb_serial *serial, u16 value, @@ -395,16 +398,14 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty, if (spriv->type->max_baud_rate) baud = min_t(speed_t, baud, spriv->type->max_baud_rate); /* - * Set baud rate to nearest supported value. - * - * NOTE: Baud rate 500k can only be set using divisors. + * Use direct method for supported baud rates, otherwise use divisors. */ baud_sup = pl2303_get_supported_baud_rate(baud); - if (baud == 500000) - baud = pl2303_encode_baud_rate_divisor(buf, baud); + if (baud == baud_sup) + baud = pl2303_encode_baud_rate_direct(buf, baud); else - baud = pl2303_encode_baud_rate_direct(buf, baud_sup); + baud = pl2303_encode_baud_rate_divisor(buf, baud); /* Save resulting baud rate */ tty_encode_baud_rate(tty, baud, baud); -- cgit v1.1 From b9f040389e23fb95fde36cb0a3c2c516fb3e9d1c Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 18 Aug 2014 18:14:52 +0200 Subject: USB: serial: add support for multi-port simple drivers Add support for multi-port simple drivers. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb-serial-simple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index fb79775..02cb77a 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c @@ -20,7 +20,7 @@ #include #include -#define DEVICE(vendor, IDS) \ +#define DEVICE_N(vendor, IDS, nport) \ static const struct usb_device_id vendor##_id_table[] = { \ IDS(), \ { }, \ @@ -31,9 +31,10 @@ static struct usb_serial_driver vendor##_device = { \ .name = #vendor, \ }, \ .id_table = vendor##_id_table, \ - .num_ports = 1, \ + .num_ports = nport, \ }; +#define DEVICE(vendor, IDS) DEVICE_N(vendor, IDS, 1) /* ZIO Motherboard USB driver */ #define ZIO_IDS() \ -- cgit v1.1 From c5cd24d7b179a415df263e5b18b72f6e3aaf81e0 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 18 Aug 2014 18:14:53 +0200 Subject: USB: serial: add Novatel Wireless GPS driver Add simple driver for Novatel Wireless GPS receivers. Reported-by: Kirk Madsen Tested-by: Kirk Madsen Signed-off-by: Johan Hovold --- drivers/usb/serial/Kconfig | 1 + drivers/usb/serial/usb-serial-simple.c | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 3ce5c74..ab05158 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -61,6 +61,7 @@ config USB_SERIAL_SIMPLE - Fundamental Software dongle. - HP4x calculators - a number of Motorola phones + - Novatel Wireless GPS receivers - Siemens USB/MPI adapter. - ViVOtech ViVOpay USB device. - Infineon Modem Flashloader USB interface diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index 02cb77a..5565308 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c @@ -65,6 +65,11 @@ DEVICE(vivopay, VIVOPAY_IDS); { USB_DEVICE(0x22b8, 0x2c64) } /* Motorola V950 phone */ DEVICE(moto_modem, MOTO_IDS); +/* Novatel Wireless GPS driver */ +#define NOVATEL_IDS() \ + { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */ +DEVICE_N(novatel_gps, NOVATEL_IDS, 3); + /* HP4x (48/49) Generic Serial driver */ #define HP4X_IDS() \ { USB_DEVICE(0x03f0, 0x0121) } @@ -88,6 +93,7 @@ static struct usb_serial_driver * const serial_drivers[] = { &flashloader_device, &vivopay_device, &moto_modem_device, + &novatel_gps_device, &hp4x_device, &suunto_device, &siemens_mpi_device, @@ -100,6 +106,7 @@ static const struct usb_device_id id_table[] = { FLASHLOADER_IDS(), VIVOPAY_IDS(), MOTO_IDS(), + NOVATEL_IDS(), HP4X_IDS(), SUUNTO_IDS(), SIEMENS_IDS(), -- cgit v1.1 From cff9c2339a6d5105d7f6b1f9a96dd1d239cc76ac Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 18 Aug 2014 18:23:19 +0200 Subject: USB: serial: add Medtronic CareLink USB driver Add simple driver for Medtronic CareLink USB devices. Reported-by: Benjamin West Tested-by: Benjamin West Signed-off-by: Johan Hovold --- drivers/usb/serial/Kconfig | 1 + drivers/usb/serial/usb-serial-simple.c | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index ab05158..c3119eb 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -58,6 +58,7 @@ config USB_SERIAL_SIMPLE handles a wide range of very simple devices, all in one driver. Specifically, it supports: - Suunto ANT+ USB device. + - Medtronic CareLink USB device - Fundamental Software dongle. - HP4x calculators - a number of Motorola phones diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index 5565308..7064eb8 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c @@ -36,6 +36,11 @@ static struct usb_serial_driver vendor##_device = { \ #define DEVICE(vendor, IDS) DEVICE_N(vendor, IDS, 1) +/* Medtronic CareLink USB driver */ +#define CARELINK_IDS() \ + { USB_DEVICE(0x0a21, 0x8001) } /* MMT-7305WW */ +DEVICE(carelink, CARELINK_IDS); + /* ZIO Motherboard USB driver */ #define ZIO_IDS() \ { USB_DEVICE(0x1CBE, 0x0103) } @@ -88,6 +93,7 @@ DEVICE(siemens_mpi, SIEMENS_IDS); /* All of the above structures mushed into two lists */ static struct usb_serial_driver * const serial_drivers[] = { + &carelink_device, &zio_device, &funsoft_device, &flashloader_device, @@ -101,6 +107,7 @@ static struct usb_serial_driver * const serial_drivers[] = { }; static const struct usb_device_id id_table[] = { + CARELINK_IDS(), ZIO_IDS(), FUNSOFT_IDS(), FLASHLOADER_IDS(), -- cgit v1.1 From 7c13325380ee520ece4ddf517c6f6f895eb63f98 Mon Sep 17 00:00:00 2001 From: Frans Klaver Date: Mon, 1 Sep 2014 11:39:21 +0200 Subject: usb: serial: xsens_mt: add author and description Signed-off-by: Frans Klaver Signed-off-by: Johan Hovold --- drivers/usb/serial/xsens_mt.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/xsens_mt.c b/drivers/usb/serial/xsens_mt.c index 4841fb5..d500ccd 100644 --- a/drivers/usb/serial/xsens_mt.c +++ b/drivers/usb/serial/xsens_mt.c @@ -82,4 +82,6 @@ static struct usb_serial_driver * const serial_drivers[] = { module_usb_serial_driver(serial_drivers, id_table); +MODULE_AUTHOR("Frans Klaver "); +MODULE_DESCRIPTION("USB-serial driver for Xsens motion trackers"); MODULE_LICENSE("GPL"); -- cgit v1.1 From adceac14166da8c466223a35ec59c4a4adeef976 Mon Sep 17 00:00:00 2001 From: Frans Klaver Date: Thu, 4 Sep 2014 09:25:37 +0200 Subject: usb: serial: xsens_mt: always bind to interface number 1 Probe is testing if the current interface provides two bulk endpoints. While this achieves the goal of only binding to the correct interface, we already know we can find the device on interface number 1. Stop checking the endpoints and just return successfully when interface number 1 is probed. Signed-off-by: Frans Klaver Signed-off-by: Johan Hovold --- drivers/usb/serial/xsens_mt.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/xsens_mt.c b/drivers/usb/serial/xsens_mt.c index d500ccd..3837d51 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[] = { }; MODULE_DEVICE_TABLE(usb, id_table); -static int has_required_endpoints(const struct usb_host_interface *interface) -{ - __u8 i; - int has_bulk_in = 0; - int has_bulk_out = 0; - - for (i = 0; i < interface->desc.bNumEndpoints; ++i) { - if (usb_endpoint_is_bulk_in(&interface->endpoint[i].desc)) - has_bulk_in = 1; - else if (usb_endpoint_is_bulk_out(&interface->endpoint[i].desc)) - has_bulk_out = 1; - } - - return has_bulk_in && has_bulk_out; -} - static int xsens_mt_probe(struct usb_serial *serial, const struct usb_device_id *id) { - if (!has_required_endpoints(serial->interface->cur_altsetting)) - return -ENODEV; - return 0; + if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1) + return 0; + + return -ENODEV; } static struct usb_serial_driver xsens_mt_device = { -- cgit v1.1 From f8c0e057b4898055b24b44d03b837a15d8b93b37 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 15 Sep 2014 18:40:45 +0200 Subject: USB: serial: remove zte_ev driver The zte_ev driver is based on code (once) distributed by ZTE that still appears to originally have been reverse-engineered and bolted onto the generic driver. A closer analysis of the zte_ev setup code reveals that it consists of standard CDC requests (SET/GET_LINE_CODING and SET_CONTROL_LINE_STATE) but unfortunately fails to get some of those right. In particular, as reported by Lei Liu, it fails to lower DTR/RTS on close. It also appears that the control requests lack the interface argument. Since line control is already handled properly by the option driver, and the SET/GET_LINE_CODING requests appears to be redundant (amounts to a SET 9600 8N1) let's remove the redundant zte_ev driver. Also move the remaining ZTE PIDs to the generic option modem driver. Reported-by: Lei Liu Signed-off-by: Johan Hovold --- drivers/usb/serial/Kconfig | 8 -- drivers/usb/serial/Makefile | 1 - drivers/usb/serial/option.c | 11 +- drivers/usb/serial/zte_ev.c | 305 -------------------------------------------- 4 files changed, 10 insertions(+), 315 deletions(-) delete mode 100644 drivers/usb/serial/zte_ev.c (limited to 'drivers/usb') diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index c3119eb..a69f7cd 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -684,14 +684,6 @@ config USB_SERIAL_WISHBONE To compile this driver as a module, choose M here: the module will be called wishbone-serial. -config USB_SERIAL_ZTE - tristate "ZTE USB serial driver" - help - Say Y here if you want to use a ZTE USB to serial device. - - To compile this driver as a module, choose M here: the - module will be called zte. - config USB_SERIAL_SSU100 tristate "USB Quatech SSU-100 Single Port Serial Driver" help diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index bfdafd3..349d9df 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -60,4 +60,3 @@ obj-$(CONFIG_USB_SERIAL_WISHBONE) += wishbone-serial.o obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o obj-$(CONFIG_USB_SERIAL_XSENS_MT) += xsens_mt.o -obj-$(CONFIG_USB_SERIAL_ZTE) += zte_ev.o diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 54a8120..d1a3f60 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); #define ZTE_PRODUCT_MF628 0x0015 #define ZTE_PRODUCT_MF626 0x0031 #define ZTE_PRODUCT_AC2726 0xfff1 +#define ZTE_PRODUCT_MG880 0xfffd #define ZTE_PRODUCT_CDMA_TECH 0xfffe #define ZTE_PRODUCT_AC8710T 0xffff #define ZTE_PRODUCT_MC2718 0xffe8 @@ -1560,7 +1561,15 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, - + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffec, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffee, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff6, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff7, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff8, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfff9, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfffb, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xfffc, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MG880, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c deleted file mode 100644 index c9bb107..0000000 --- a/drivers/usb/serial/zte_ev.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * ZTE_EV USB serial driver - * - * Copyright (C) 2012 Greg Kroah-Hartman - * Copyright (C) 2012 Linux Foundation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This driver is based on code found in a ZTE_ENV patch that modified - * the usb-serial generic driver. Comments were left in that I think - * show the commands used to talk to the device, but I am not sure. - */ -#include -#include -#include -#include -#include -#include -#include - -#define MAX_SETUP_DATA_SIZE 32 - -static void debug_data(struct device *dev, const char *function, int len, - const unsigned char *data, int result) -{ - dev_dbg(dev, "result = %d\n", result); - if (result == len) - dev_dbg(dev, "%s - length = %d, data = %*ph\n", function, - len, len, data); -} - -static int zte_ev_usb_serial_open(struct tty_struct *tty, - struct usb_serial_port *port) -{ - struct usb_device *udev = port->serial->dev; - struct device *dev = &port->dev; - int result = 0; - int len; - unsigned char *buf; - - buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - /* send 1st ctl cmd(CTL 21 22 01 00 00 00 00 00) */ - len = 0; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x22, 0x21, - 0x0001, 0x0000, NULL, len, - USB_CTRL_GET_TIMEOUT); - dev_dbg(dev, "result = %d\n", result); - - /* send 2st cmd and receive data */ - /* - * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 25.1.0(5) - * 16.0 DI 00 96 00 00 00 00 08 - */ - len = 0x0007; - result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), - 0x21, 0xa1, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 3rd cmd */ - /* - * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 30.1.0 - * 16.0 DO 80 25 00 00 00 00 08 .%..... 30.2.0 - */ - len = 0x0007; - buf[0] = 0x80; - buf[1] = 0x25; - buf[2] = 0x00; - buf[3] = 0x00; - buf[4] = 0x00; - buf[5] = 0x00; - buf[6] = 0x08; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x20, 0x21, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 4th cmd */ - /* - * 16.0 CTL 21 22 03 00 00 00 00 00 - */ - len = 0; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x22, 0x21, - 0x0003, 0x0000, NULL, len, - USB_CTRL_GET_TIMEOUT); - dev_dbg(dev, "result = %d\n", result); - - /* send 5th cmd */ - /* - * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 33.1.0 - * 16.0 DI 80 25 00 00 00 00 08 - */ - len = 0x0007; - result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), - 0x21, 0xa1, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 6th cmd */ - /* - * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 34.1.0 - * 16.0 DO 80 25 00 00 00 00 08 - */ - len = 0x0007; - buf[0] = 0x80; - buf[1] = 0x25; - buf[2] = 0x00; - buf[3] = 0x00; - buf[4] = 0x00; - buf[5] = 0x00; - buf[6] = 0x08; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x20, 0x21, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - kfree(buf); - - return usb_serial_generic_open(tty, port); -} - -/* - * CTL 21 22 02 00 00 00 00 00 CLASS 338.1.0 - * - * 16.1 DI a1 20 00 00 00 00 02 00 02 00 . ........ 340.1.0 - * 16.0 CTL 21 22 03 00 00 00 00 00 CLASS 341.1.0 - * - * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 346.1.0(3) - * 16.0 DI 00 08 07 00 00 00 08 ....... 346.2.0 - * - * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 349.1.0 - * 16.0 DO 00 c2 01 00 00 00 08 ....... 349.2.0 - * - * 16.0 CTL 21 22 03 00 00 00 00 00 CLASS 350.1.0(2) - * - * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 352.1.0 - * 16.0 DI 00 c2 01 00 00 00 08 ....... 352.2.0 - * - * 16.1 DI a1 20 00 00 00 00 02 00 02 00 . ........ 353.1.0 - * - * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 354.1.0 - * 16.0 DO 00 c2 01 00 00 00 08 ....... 354.2.0 - * - * 16.0 CTL 21 22 03 00 00 00 00 00 -*/ - -static void zte_ev_usb_serial_close(struct usb_serial_port *port) -{ - struct usb_device *udev = port->serial->dev; - struct device *dev = &port->dev; - int result = 0; - int len; - unsigned char *buf; - - buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); - if (!buf) - return; - - /* send 1st ctl cmd(CTL 21 22 02 00 00 00 00 00) */ - len = 0; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x22, 0x21, - 0x0002, 0x0000, NULL, len, - USB_CTRL_GET_TIMEOUT); - dev_dbg(dev, "result = %d\n", result); - - /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */ - len = 0; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x22, 0x21, - 0x0003, 0x0000, NULL, len, - USB_CTRL_GET_TIMEOUT); - dev_dbg(dev, "result = %d\n", result); - - /* send 3st cmd and recieve data */ - /* - * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 25.1.0(5) - * 16.0 DI 00 08 07 00 00 00 08 - */ - len = 0x0007; - result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), - 0x21, 0xa1, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 4th cmd */ - /* - * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 30.1.0 - * 16.0 DO 00 c2 01 00 00 00 08 .%..... 30.2.0 - */ - len = 0x0007; - buf[0] = 0x00; - buf[1] = 0xc2; - buf[2] = 0x01; - buf[3] = 0x00; - buf[4] = 0x00; - buf[5] = 0x00; - buf[6] = 0x08; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x20, 0x21, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 5th cmd */ - /* - * 16.0 CTL 21 22 03 00 00 00 00 00 - */ - len = 0; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x22, 0x21, - 0x0003, 0x0000, NULL, len, - USB_CTRL_GET_TIMEOUT); - dev_dbg(dev, "result = %d\n", result); - - /* send 6th cmd */ - /* - * 16.0 CTL a1 21 00 00 00 00 07 00 CLASS 33.1.0 - * 16.0 DI 00 c2 01 00 00 00 08 - */ - len = 0x0007; - result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), - 0x21, 0xa1, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 7th cmd */ - /* - * 16.0 CTL 21 20 00 00 00 00 07 00 CLASS 354.1.0 - * 16.0 DO 00 c2 01 00 00 00 08 ....... 354.2.0 - */ - len = 0x0007; - buf[0] = 0x00; - buf[1] = 0xc2; - buf[2] = 0x01; - buf[3] = 0x00; - buf[4] = 0x00; - buf[5] = 0x00; - buf[6] = 0x08; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x20, 0x21, - 0x0000, 0x0000, buf, len, - USB_CTRL_GET_TIMEOUT); - debug_data(dev, __func__, len, buf, result); - - /* send 8th cmd */ - /* - * 16.0 CTL 21 22 03 00 00 00 00 00 - */ - len = 0; - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - 0x22, 0x21, - 0x0003, 0x0000, NULL, len, - USB_CTRL_GET_TIMEOUT); - dev_dbg(dev, "result = %d\n", result); - - kfree(buf); - - usb_serial_generic_close(port); -} - -static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x19d2, 0xffec) }, - { USB_DEVICE(0x19d2, 0xffee) }, - { USB_DEVICE(0x19d2, 0xfff6) }, - { USB_DEVICE(0x19d2, 0xfff7) }, - { USB_DEVICE(0x19d2, 0xfff8) }, - { USB_DEVICE(0x19d2, 0xfff9) }, - { USB_DEVICE(0x19d2, 0xfffb) }, - { USB_DEVICE(0x19d2, 0xfffc) }, - /* MG880 */ - { USB_DEVICE(0x19d2, 0xfffd) }, - { }, -}; -MODULE_DEVICE_TABLE(usb, id_table); - -static struct usb_serial_driver zio_device = { - .driver = { - .owner = THIS_MODULE, - .name = "zte_ev", - }, - .id_table = id_table, - .num_ports = 1, - .open = zte_ev_usb_serial_open, - .close = zte_ev_usb_serial_close, -}; - -static struct usb_serial_driver * const serial_drivers[] = { - &zio_device, NULL -}; - -module_usb_serial_driver(serial_drivers, id_table); -MODULE_LICENSE("GPL v2"); -- cgit v1.1