From ian.abbott@mev.co.uk Thu Jul 28 10:43:35 2005 Message-ID: <42E91890.7000300@mev.co.uk> Date: Thu, 28 Jul 2005 18:40:32 +0100 From: Ian Abbott Cc: Greg KH Subject: USB ftdi_sio: user specified VID/PID ftdi_sio: Support one user specified vendor and product ID via a couple of new module parameters. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ftdi_sio.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletion(-) --- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.c 2005-08-02 13:41:29.000000000 -0700 +++ gregkh-2.6/drivers/usb/serial/ftdi_sio.c 2005-08-08 15:29:06.000000000 -0700 @@ -269,6 +269,8 @@ #define DRIVER_DESC "USB FTDI Serial Converters Driver" static int debug; +static __u16 vendor = FTDI_VID; +static __u16 product; /* struct ftdi_sio_quirk is used by devices requiring special attention. */ struct ftdi_sio_quirk { @@ -432,7 +434,8 @@ { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, - { } /* Terminating entry */ + { }, /* Optional parameter entry */ + { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, id_table_combined); @@ -2030,6 +2033,15 @@ int retval; dbg("%s", __FUNCTION__); + if (vendor > 0 && product > 0) { + /* Add user specified VID/PID to reserved element of table. */ + int i; + for (i = 0; id_table_combined[i].idVendor; i++) + ; + id_table_combined[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; + id_table_combined[i].idVendor = vendor; + id_table_combined[i].idProduct = product; + } retval = usb_serial_register(&ftdi_sio_device); if (retval) goto failed_sio_register; @@ -2066,4 +2078,9 @@ module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); +module_param(vendor, ushort, 0); +MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" + __MODULE_STRING(FTDI_VID)")"); +module_param(product, ushort, 0); +MODULE_PARM_DESC(vendor, "User specified product ID");