This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
USB ethernet host driver bug fix/minor improvement
- From: David Smith <dsmith at redhat dot com>
- To: eCos Patches <ecos-patches at sources dot redhat dot com>
- Date: 26 Jul 2002 12:58:56 -0500
- Subject: USB ethernet host driver bug fix/minor improvement
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.
Index: packages/io/usb/eth/slave/current/host/ecos_usbeth.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/usb/eth/slave/current/host/ecos_usbeth.c,v
retrieving revision 1.5
diff -u -p -r1.5 ecos_usbeth.c
--- packages/io/usb/eth/slave/current/host/ecos_usbeth.c 23 May 2002 23:06:32 -0000 1.5
+++ packages/io/usb/eth/slave/current/host/ecos_usbeth.c 26 Jul 2002 17:56:37 -0000
@@ -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) ||
--
David Smith
dsmith@redhat.com
Red Hat, Inc.
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)