From d377df04c9ee2d7e7fb94168b5e0a3df5e3152f5 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Fri, 24 Aug 2007 11:19:50 +0200 Subject: [PATCH] support for multiple USB cables by Mondrian Nuessle --- usb-driver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/usb-driver.c b/usb-driver.c index e620145..1fcfae1 100644 --- a/usb-driver.c +++ b/usb-driver.c @@ -466,6 +466,9 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { { struct event *e = (struct event*)(wdheader->data); struct usb_bus *bus; + char* device_num; + char* remainder; + int devnum = -1; int i; DPRINTF("handle: %lu, action: %lu, status: %lu, eventid: %lu, cardtype: %lu, kplug: %lu, options: %lu, dev: %lx:%lx, unique: %lu, ver: %lu, nummatch: %lu\n", @@ -477,6 +480,15 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { e->u.Usb.dwUniqueID, e->dwEventVer, e->dwNumMatchTables); + device_num=getenv("XILINX_USB_DEVNUM"); + if (device_num!=NULL) { + DPRINTF("XILINX_USB_BUS=%s\n",device_num); + devnum=strtol(device_num,&remainder,10); + if (device_num==remainder) /* no integer in env variable */ + devnum=-1; + } + + for (i = 0; i < e->dwNumMatchTables; i++) { DPRINTF("match: dev: %04x:%04x, class: %x, subclass: %x, intclass: %x, intsubclass: %x, intproto: %x\n", @@ -497,7 +509,8 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { if((desc->idVendor == e->matchTables[i].VendorId) && (desc->idProduct == e->matchTables[i].ProductId) && (desc->bDeviceClass == e->matchTables[i].bDeviceClass) && - (desc->bDeviceSubClass == e->matchTables[i].bDeviceSubClass)) { + (desc->bDeviceSubClass == e->matchTables[i].bDeviceSubClass) && + ((devnum == -1) || (dev->devnum == devnum)) ) { int ac; for (ac = 0; ac < desc->bNumConfigurations; ac++) { struct usb_interface *interface = dev->config[ac].interface; -- 2.39.2