You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using libusb 1.0.21 with a Samsung SM-T580 (Android 6.0.1 API23) rooted tablet. If I have at least one external device attached to the bus then libusb_init()returns ok, but if there aren't any external devices attached, then libusb_init() fails with LIBUSB_ERROR_IO.
The reason is that when there aren't any devices attached, then readdir(devices) in sysfs_get_device_list() just returns two entries "." and ".." and this is considered an IO-error.
But if I attach a single device then readdir(devices) returns ".", "..", "1-1", "usb1", "usb2", "1-0:1.0", "1-1:1.0" and "2-0:1.0". This is an OTG device so it might explain why no devices (even no root hub) are reported when no external devices are attached.
But shouldn't it be allowed to initialize libusb even if there are no devices on the bus, or if this is an OTG device?
The text was updated successfully, but these errors were encountered:
When using sysfs to scan for devices, libusb_init() will fail if there
are no USB devices present. There is no reason for this behavior, so
this commit modifies the logic to only return an error if one or more
devices are present but none could be successfully enumerated.
Closeslibusb#301
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Seneral
pushed a commit
to Seneral/libusb
that referenced
this issue
Sep 21, 2021
When using sysfs to scan for devices, libusb_init() will fail if there
are no USB devices present. There is no reason for this behavior, so
this commit modifies the logic to only return an error if one or more
devices are present but none could be successfully enumerated.
Closeslibusb#301
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
I'm using libusb 1.0.21 with a Samsung SM-T580 (Android 6.0.1 API23) rooted tablet. If I have at least one external device attached to the bus then
libusb_init()
returns ok, but if there aren't any external devices attached, thenlibusb_init()
fails withLIBUSB_ERROR_IO
.The call chain is
The reason is that when there aren't any devices attached, then
readdir(devices)
insysfs_get_device_list()
just returns two entries "." and ".." and this is considered an IO-error.But if I attach a single device then
readdir(devices)
returns ".", "..", "1-1", "usb1", "usb2", "1-0:1.0", "1-1:1.0" and "2-0:1.0". This is an OTG device so it might explain why no devices (even no root hub) are reported when no external devices are attached.But shouldn't it be allowed to initialize libusb even if there are no devices on the bus, or if this is an OTG device?
The text was updated successfully, but these errors were encountered: