[PATCH] USB: serial-generic: use a single set of device IDs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The usb-serial-generic driver uses different device IDs for its USB
matching and its serial matching.  This can lead to problems: The
driver can end up getting bound to a USB interface without being
allowed to bind to the corresponding serial port.

This patch (as1557) fixes the problem by using the same device ID
table (the one that can be altered by the "vendor=" and "product="
module parameters) for both purposes.  The unused table is removed.
Now the driver will bind only to the intended devices.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
CC: Bjørn Mork <bjorn@xxxxxxx>

---

This patch will need to get into 3.5.

 drivers/usb/serial/generic.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Index: usb-3.4/drivers/usb/serial/generic.c
===================================================================
--- usb-3.4.orig/drivers/usb/serial/generic.c
+++ usb-3.4/drivers/usb/serial/generic.c
@@ -39,13 +39,6 @@ MODULE_PARM_DESC(product, "User specifie
 
 static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
 
-/* we want to look at all devices, as the vendor/product id can change
- * depending on the command line argument */
-static const struct usb_device_id generic_serial_ids[] = {
-	{.driver_info = 42},
-	{}
-};
-
 /* All of the device info needed for the Generic Serial Converter */
 struct usb_serial_driver usb_serial_generic_device = {
 	.driver = {
@@ -79,7 +72,8 @@ int usb_serial_generic_register(int _deb
 		USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
 
 	/* register our generic driver with ourselves */
-	retval = usb_serial_register_drivers(serial_drivers, "usbserial_generic", generic_serial_ids);
+	retval = usb_serial_register_drivers(serial_drivers,
+			"usbserial_generic", generic_device_ids);
 #endif
 	return retval;
 }

--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux