You are not logged in.

#1 2009-04-03 19:58:43

aport
Member
From: San Diego
Registered: 2008-02-20
Posts: 99

device_id_table for usbserial_generic?

I've got a few devices, 3G modems specifically, that don't work with any usb-serial driver except generic. If I add the vendorID and productID to the device tables in option, airprime, hso, etc... the cards are detected, mounted as modems, then nothing happens. If I manually insmod usbserial with vendor=0xXXXX and product=0xXXXX the cards work perfectly.


I would like to avoid having to manually modprobe usbserial when I want to use these cards.


Does anyone know of a way to tell usbserial to use a device id table? I've never messed around with drivers before =/

Offline

#2 2009-04-05 05:56:00

aport
Member
From: San Diego
Registered: 2008-02-20
Posts: 99

Re: device_id_table for usbserial_generic?

Got it smile

My patch, in case anyone is remotely interested:

--- linux-2.6.24.7/drivers/usb/serial/generic.c    2008-05-06 16:22:34.000000000 -0700
+++ linux-2.6.24.7/drivers/usb/serial/generic.c    2009-04-03 16:27:47.000000000 -0700
@@ -37,14 +35,20 @@
 module_param(product, ushort, 0);
 MODULE_PARM_DESC(product, "User specified USB idProduct");
 
-static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
+/*
+ * Standard usb_device_id struct
+ * Following model shown in usb-skeleton.c
+ */
 
-/* we want to look at all devices, as the vendor/product id can change
- * depending on the command line argument */
 static struct usb_device_id generic_serial_ids[] = {
-    {.driver_info = 42},
-    {}
+    { USB_DEVICE(0x106c, 0x3714) }, /* Pantech UM175 */
+    { USB_DEVICE(0x106c, 0x3711) }, /* Pantech UM150 */
+    { USB_DEVICE(0x106c, 0x3702) }, /* Pantech PC5750 */
+    { },
 };
+MODULE_DEVICE_TABLE(usb, generic_serial_ids);
 
 static struct usb_driver generic_driver = {
     .name =        "usbserial_generic",
@@ -60,7 +66,7 @@
         .owner =    THIS_MODULE,
         .name =        "generic",
     },
-    .id_table =        generic_device_ids,
+    .id_table =        generic_serial_ids,
     .usb_driver =         &generic_driver,
     .num_interrupt_in =    NUM_DONT_CARE,
     .num_bulk_in =        NUM_DONT_CARE,
@@ -77,7 +83,7 @@
 {
     const struct usb_device_id *id_pattern;
 
-    id_pattern = usb_match_id(interface, generic_device_ids);
+    id_pattern = usb_match_id(interface, generic_serial_ids);
     if (id_pattern != NULL)
         return usb_serial_probe(interface, id);
     return -ENODEV;
@@ -90,9 +96,10 @@
 
     debug = _debug;
 #ifdef CONFIG_USB_SERIAL_GENERIC
-    generic_device_ids[0].idVendor = vendor;
+/*    generic_device_ids[0].idVendor = vendor;
     generic_device_ids[0].idProduct = product;
     generic_device_ids[0].match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
+*/
 
     /* register our generic driver with ourselves */
     retval = usb_serial_register (&usb_serial_generic_device);

I still don't know if that's the *absolutely proper* way to due it; I just followed the examples in usb-skeleton.c and the option, airprime, and such drivers.
The three devices are for my 3G cards. When plugged in, usbserial_generic pops up and takes them. Now I don't have to manually modprobe with vendorID and productID! Hooray!

Offline

Board footer

Powered by FluxBB