libusb_config_descriptor return negative value on windows

126 Views Asked by At

I'm trying to get a list of all USB devices on a Windows System using VC++ and Windows Backend of LibUSB. But it seems the libusb_get_config_descriptor(dev, 0, &config); returns a negative value.

   static void print_devs(libusb_device **devs)
 {
   libusb_device *dev;
   int i = 0;
    while ((dev = devs[i++]) != NULL) {

    struct libusb_config_descriptor *config;
    int rr = libusb_get_config_descriptor(dev, 0, &config);
    if ( rr!= 0)
    {
        printf("Error!! %d",rr);
        return;
    }
    //get interface descriptors and interface class and sub class so on...

Why is this happening?

0

There are 0 best solutions below