Search code examples
clinuxlibusb

libusb_get_device_descriptor() always returns 0. How do I detect failure?


Prior to version 1.0.16 of libusb, libusb_get_device_descriptor() would return 0 for success or a negative integer to indicate failure. With version 1.0.16 and later, this function always returns 0. How do I detect and figure out why I fail to get a descriptor now that that convenient means of figuring it out is gone?


Solution

  • Documentation explicitly states that

    Note since libusb-1.0.16, LIBUSB_API_VERSION >= 0x01000102, this function always succeeds.

    This means you should never fail to get descriptor.