From 312b706d0a26b7c892b7f94a5e14a9bf2f09e06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 28 Feb 2011 01:09:15 +0100 Subject: check SearchDevices --- libk8055/libk8055.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index a2eef7c..7de3919 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -274,21 +274,20 @@ long SetCurrentDevice(long deviceno) { } /* New function in version 2 of Velleman DLL, should return devices-found bitmask or 0*/ -long SearchDevices(void) -{ +long SearchDevices(void) { int retval = 0; - init_usb(); - /* start looping through the devices to find the correct one */ - for (bus = busses; bus; bus = bus->next) - { - for (dev = bus->devices; dev; dev = dev->next) - { + usb_init(); + usb_find_busses(); + usb_find_devices(); + struct usb_bus* busses = usb_get_busses(); + for (struct usb_bus* bus = busses; bus; bus = bus->next) { + for( struct usb_device* dev=bus->devices; dev; dev=dev->next ) { if (dev->descriptor.idVendor == VELLEMAN_VENDOR_ID) { - if(dev->descriptor.idProduct == K8055_IPID + 0) retval |= 0x01; - if(dev->descriptor.idProduct == K8055_IPID + 1) retval |= 0x02; - if(dev->descriptor.idProduct == K8055_IPID + 2) retval |= 0x04; - if(dev->descriptor.idProduct == K8055_IPID + 3) retval |= 0x08; - /* else some other kind of Velleman board */ + if(dev->descriptor.idProduct == K8055_IPID + 0) retval |= 0x01; + if(dev->descriptor.idProduct == K8055_IPID + 1) retval |= 0x02; + if(dev->descriptor.idProduct == K8055_IPID + 2) retval |= 0x04; + if(dev->descriptor.idProduct == K8055_IPID + 3) retval |= 0x08; + /* else some other kind of Velleman board */ } } } -- cgit v1.1-2-g2b99