|
From: <ww...@se...> - 2007-01-21 21:02:52
|
Hi all,
I have a small program to show list of connected usb devices. It works fine under Linux, but when I port it into libusb-win32, it doesn't - it doesn't detect any device! And I really don't know why :(
Attached example - testlibusb.c doesn't detect any device too.
I'm using WinXP, libusb-win32-snapshot-20060827.
Here is my code:
#include <stdio.h>
#include "usb.h"
int print_device(struct usb_device *dev)
{
usb_dev_handle *udev;
int ret, i;
printf("dev:%i\n", dev);
udev = usb_open(dev);
printf("udev:%i", udev);
printf("#%x - %x\n", dev->descriptor.idVendor, dev->descriptor.idProduct);
for (i = 0; i < dev->num_children; i++)
print_device(dev->children[i]);
return 0;
}
int main(int argc, char *argv[])
{
struct usb_bus *bus;
usb_init();
usb_set_debug(0);
usb_find_busses();
usb_find_devices();
for (bus = usb_get_busses(); bus; bus = bus->next) {
struct usb_device *dev;
printf("bus:%i\n", bus);
printf("bus->devices:%i\n", bus->devices);
for (dev = bus->devices; dev; dev = dev->next) {
print_device(dev);
}
}
return 0;
}
output:
bus:4846846
bus->devices:0
Can anyone help me, please... ? I've installed libusb0.dll into program's directory and then into system32, but it still doesn't work. Thanx in advance.
|