summaryrefslogtreecommitdiffstats
path: root/libk8055/libk8055.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-02-28 01:09:15 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-02-28 01:09:15 +0100
commit312b706d0a26b7c892b7f94a5e14a9bf2f09e06e (patch)
treee2719e59d3c052fa27cead91a896321fb380fdb0 /libk8055/libk8055.c
parent2bbeb8643b2618fe05c362e0fa87e37cf9f689e0 (diff)
downloadk8055-312b706d0a26b7c892b7f94a5e14a9bf2f09e06e.zip
k8055-312b706d0a26b7c892b7f94a5e14a9bf2f09e06e.tar.gz
check SearchDevices
Diffstat (limited to 'libk8055/libk8055.c')
-rw-r--r--libk8055/libk8055.c25
1 files 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 */
}
}
}