Allow device Vendor/Product IDs to be specified via module parameters. Signed-off-by: Craig Shelley <craig@xxxxxxxxxxxxxxxx> --- drivers/usb/serial/cp210x.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 969adab..a23fa73 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -27,7 +27,7 @@ /* * Version Information */ -#define DRIVER_VERSION "v0.09" +#define DRIVER_VERSION "v0.10" #define DRIVER_DESC "Silicon Labs CP210x RS232 serial adaptor driver" /* @@ -52,8 +52,10 @@ static void cp210x_dtr_rts(struct usb_serial_port *p, int on); static int cp210x_carrier_raised(struct usb_serial_port *p); static int debug; +static __u16 vendor = 0x10C4; +static __u16 product = 0x0000; -static const struct usb_device_id id_table[] = { +static struct usb_device_id id_table[] = { { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ @@ -131,7 +133,8 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ - { } /* Terminating Entry */ + { }, /* Optional parameter entry */ + { } /* Terminating Entry */ }; MODULE_DEVICE_TABLE(usb, id_table); @@ -796,6 +799,15 @@ static int __init cp210x_init(void) { int retval; + if (vendor > 0 && product > 0) { + /* Add user specified VID/PID to reserved element of table. */ + int i; + for (i = 0; id_table[i].idVendor; i++); + id_table[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; + id_table[i].idVendor = vendor; + id_table[i].idProduct = product; + } + retval = usb_serial_register(&cp210x_device); if (retval) return retval; /* Failed to register */ @@ -828,3 +840,7 @@ MODULE_LICENSE("GPL"); module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Enable verbose debugging messages"); +module_param(vendor, ushort, 0); +MODULE_PARM_DESC(vendor, "User specified vendor ID (default=0x10C4)"); +module_param(product, ushort, 0); +MODULE_PARM_DESC(product, "User specified product ID"); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html