Before you can communicate with any devices, you need to find the device you want to talk to. This is accomplished by finding all of the busses and then finding all of the devices on all of the busses:
struct usb_bus *busses; usb_init(); usb_find_busses(); usb_find_devices(); busses = usb_get_busses(); |
After this, you manually loop through all of the busess and all of the devices and matching the device by whatever criteria you need:
struct usb_bus *bus; /* ... */ for (bus = busses; bus; bus = bus->next) { struct usb_device *dev; for (dev = bus->devices; dev; dev = dev->next) { if (dev->descriptor.bDeviceClass == 0x10) { /* Open the device and do your processing */ } } } |