Fix libusb_get_device_list return value

It was documented to return the list length, but was returning 0.
This commit is contained in:
Daniel Drake 2008-05-04 00:51:59 +01:00
parent a74106a9b4
commit 5878daa85e
3 changed files with 17 additions and 10 deletions

View file

@ -39,14 +39,15 @@ int main(void)
{
libusb_device **devs;
int r;
size_t cnt;
r = libusb_init();
if (r < 0)
return r;
r = libusb_get_device_list(&devs);
if (r < 0)
return r;
cnt = libusb_get_device_list(&devs);
if (cnt < 0)
return (int) cnt;
print_devs(devs);
libusb_free_device_list(devs, 1);