changeset 272:ce611170e194

Commit bug fix to usbeth host-side driver provided by dsmith@redhat.com,
author bartv
date Wed, 07 Aug 2002 19:19:11 +0000
parents 8d47e3001deb
children e51742b21f31
files packages/io/usb/eth/slave/current/ChangeLog packages/io/usb/eth/slave/current/host/ecos_usbeth.c
diffstat 2 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/usb/eth/slave/current/ChangeLog
+++ b/packages/io/usb/eth/slave/current/ChangeLog
@@ -1,3 +1,12 @@
+2002-07-26  David Smith  <dsmith@redhat.com>
+
+	* host/ecos_usbeth.c (ecos_usbeth_probe):
+	Two changes to the code that checks to see if this is the correct
+	driver for the USB peripheral that was just loaded.  Fixed a bug
+	that was comparing the product id of the peripheral to the vendor
+	id.  Supports multiple implementations (vendor id/product id sets)
+	so that the same driver could be used for several devices.
+
 2001-07-10  Bart Veer  <bartv@redhat.com>
 
 	* doc/usbseth.sgml, doc/*.html:
--- a/packages/io/usb/eth/slave/current/host/ecos_usbeth.c
+++ b/packages/io/usb/eth/slave/current/host/ecos_usbeth.c
@@ -408,11 +408,23 @@ ecos_usbeth_probe(struct usb_device* usb
     unsigned char       dummy[1];
     int                 tx_endpoint = -1;
     int                 rx_endpoint = -1;
-    
-    if ((usbdev->descriptor.idVendor  != ecos_usbeth_implementations[0].vendor) ||
-        (usbdev->descriptor.idProduct != ecos_usbeth_implementations[0].vendor)) {
+    const ecos_usbeth_impl*   impl;
+    int                 found_impl = 0;
+
+    // See if this is the correct driver for this USB peripheral.
+    impl = ecos_usbeth_implementations;
+    while (impl->name != NULL) {
+        if ((usbdev->descriptor.idVendor  != impl->vendor) ||
+            (usbdev->descriptor.idProduct != impl->id)) {
+            found_impl = 1;
+            break;
+        }
+        impl++;
+    }
+    if (! found_impl) {
         return (void*) 0;
     }
+
     // For now only support USB-ethernet peripherals consisting of a single
     // configuration, with a single interface, with two bulk endpoints.
     if ((1 != usbdev->descriptor.bNumConfigurations)  ||