aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/Kconfig2
-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
4 files changed, 32 insertions, 27 deletions
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 3ce5c74b29e4..c3119eb251bc 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
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");