Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * USB Serial "Simple" driver
0004  *
0005  * Copyright (C) 2001-2006,2008,2013 Greg Kroah-Hartman <greg@kroah.com>
0006  * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net)
0007  * Copyright (C) 2005 Thomas Hergenhahn <thomas.hergenhahn@suse.de>
0008  * Copyright (C) 2009 Outpost Embedded, LLC
0009  * Copyright (C) 2010 Zilogic Systems <code@zilogic.com>
0010  * Copyright (C) 2013 Wei Shuai <cpuwolf@gmail.com>
0011  * Copyright (C) 2013 Linux Foundation
0012  */
0013 
0014 #include <linux/kernel.h>
0015 #include <linux/tty.h>
0016 #include <linux/module.h>
0017 #include <linux/usb.h>
0018 #include <linux/usb/serial.h>
0019 
0020 #define DEVICE_N(vendor, IDS, nport)                \
0021 static const struct usb_device_id vendor##_id_table[] = {   \
0022     IDS(),                          \
0023     { },                            \
0024 };                              \
0025 static struct usb_serial_driver vendor##_device = {     \
0026     .driver = {                     \
0027         .owner =    THIS_MODULE,            \
0028         .name =     #vendor,            \
0029     },                          \
0030     .id_table =     vendor##_id_table,      \
0031     .num_ports =        nport,              \
0032 };
0033 
0034 #define DEVICE(vendor, IDS) DEVICE_N(vendor, IDS, 1)
0035 
0036 /* Medtronic CareLink USB driver */
0037 #define CARELINK_IDS()          \
0038     { USB_DEVICE(0x0a21, 0x8001) }  /* MMT-7305WW */
0039 DEVICE(carelink, CARELINK_IDS);
0040 
0041 /* ZIO Motherboard USB driver */
0042 #define ZIO_IDS()           \
0043     { USB_DEVICE(0x1CBE, 0x0103) }
0044 DEVICE(zio, ZIO_IDS);
0045 
0046 /* Funsoft Serial USB driver */
0047 #define FUNSOFT_IDS()           \
0048     { USB_DEVICE(0x1404, 0xcddc) }
0049 DEVICE(funsoft, FUNSOFT_IDS);
0050 
0051 /* Infineon Flashloader driver */
0052 #define FLASHLOADER_IDS()       \
0053     { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \
0054     { USB_DEVICE(0x8087, 0x0716) }, \
0055     { USB_DEVICE(0x8087, 0x0801) }
0056 DEVICE(flashloader, FLASHLOADER_IDS);
0057 
0058 /* Google Serial USB SubClass */
0059 #define GOOGLE_IDS()                        \
0060     { USB_VENDOR_AND_INTERFACE_INFO(0x18d1,         \
0061                     USB_CLASS_VENDOR_SPEC,  \
0062                     0x50,           \
0063                     0x01) }
0064 DEVICE(google, GOOGLE_IDS);
0065 
0066 /* Libtransistor USB console */
0067 #define LIBTRANSISTOR_IDS()         \
0068     { USB_DEVICE(0x1209, 0x8b00) }
0069 DEVICE(libtransistor, LIBTRANSISTOR_IDS);
0070 
0071 /* ViVOpay USB Serial Driver */
0072 #define VIVOPAY_IDS()           \
0073     { USB_DEVICE(0x1d5f, 0x1004) }  /* ViVOpay 8800 */
0074 DEVICE(vivopay, VIVOPAY_IDS);
0075 
0076 /* Motorola USB Phone driver */
0077 #define MOTO_IDS()          \
0078     { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */    \
0079     { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Motorola phone */    \
0080     { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */     \
0081     { USB_DEVICE(0x22b8, 0x2c84) }, /* Motorola VE240 phone */  \
0082     { USB_DEVICE(0x22b8, 0x2c64) }  /* Motorola V950 phone */
0083 DEVICE(moto_modem, MOTO_IDS);
0084 
0085 /* Motorola Tetra driver */
0086 #define MOTOROLA_TETRA_IDS()            \
0087     { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \
0088     { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \
0089     { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \
0090     { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \
0091     { USB_DEVICE(0x0cad, 0x9016) }  /* TPG2200 */
0092 DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
0093 
0094 /* Nokia mobile phone driver */
0095 #define NOKIA_IDS()         \
0096     { USB_DEVICE(0x0421, 0x069a) }  /* Nokia 130 (RM-1035) */
0097 DEVICE(nokia, NOKIA_IDS);
0098 
0099 /* Novatel Wireless GPS driver */
0100 #define NOVATEL_IDS()           \
0101     { USB_DEVICE(0x09d7, 0x0100) }  /* NovAtel FlexPack GPS */
0102 DEVICE_N(novatel_gps, NOVATEL_IDS, 3);
0103 
0104 /* HP4x (48/49) Generic Serial driver */
0105 #define HP4X_IDS()          \
0106     { USB_DEVICE(0x03f0, 0x0121) }
0107 DEVICE(hp4x, HP4X_IDS);
0108 
0109 /* Suunto ANT+ USB Driver */
0110 #define SUUNTO_IDS()            \
0111     { USB_DEVICE(0x0fcf, 0x1008) }, \
0112     { USB_DEVICE(0x0fcf, 0x1009) } /* Dynastream ANT USB-m Stick */
0113 DEVICE(suunto, SUUNTO_IDS);
0114 
0115 /* Siemens USB/MPI adapter */
0116 #define SIEMENS_IDS()           \
0117     { USB_DEVICE(0x908, 0x0004) }
0118 DEVICE(siemens_mpi, SIEMENS_IDS);
0119 
0120 /* All of the above structures mushed into two lists */
0121 static struct usb_serial_driver * const serial_drivers[] = {
0122     &carelink_device,
0123     &zio_device,
0124     &funsoft_device,
0125     &flashloader_device,
0126     &google_device,
0127     &libtransistor_device,
0128     &vivopay_device,
0129     &moto_modem_device,
0130     &motorola_tetra_device,
0131     &nokia_device,
0132     &novatel_gps_device,
0133     &hp4x_device,
0134     &suunto_device,
0135     &siemens_mpi_device,
0136     NULL
0137 };
0138 
0139 static const struct usb_device_id id_table[] = {
0140     CARELINK_IDS(),
0141     ZIO_IDS(),
0142     FUNSOFT_IDS(),
0143     FLASHLOADER_IDS(),
0144     GOOGLE_IDS(),
0145     LIBTRANSISTOR_IDS(),
0146     VIVOPAY_IDS(),
0147     MOTO_IDS(),
0148     MOTOROLA_TETRA_IDS(),
0149     NOKIA_IDS(),
0150     NOVATEL_IDS(),
0151     HP4X_IDS(),
0152     SUUNTO_IDS(),
0153     SIEMENS_IDS(),
0154     { },
0155 };
0156 MODULE_DEVICE_TABLE(usb, id_table);
0157 
0158 module_usb_serial_driver(serial_drivers, id_table);
0159 MODULE_LICENSE("GPL v2");