Discussion:
[libusb] libusb_set_interface_alt_setting fails for some interfaces
Dennis Muhlestein
2017-03-03 23:31:30 UTC
Permalink
I'm working on a device that has multiple interfaces. Some of the interfaces have 0 bandwidth alt setting 0 w/ an alt 1 that has the endpoints. On Linux (Fedora 25) There are some of these alt 1 interfaces that fail to be claimed. I can use pyusb and try to set each interface alt setting and see some succeed and some fail. I can't find much difference between the interfaces other than which endpoints are included. I'm not getting any kernel debug info in dmesg providing a hint as to whats wrong, just the error 32 as seen by LIBUSB_DEBUG=4. Also, on another OS, I can claim some of the interfaces that are failing on Linux. Any thoughts how I can debug to find out where this problem is occurring? I don't know if it's a libusb, linux kernel or device issue. Sample log attached. (interface 4 and 5 claimed fine, but 6 fails.) Also attached interface.txt which is the interface as seen by lsusb -v

TIA,
-Dennis
Chris Dickens
2017-03-03 23:46:00 UTC
Permalink
Hi,

This sounds like a device issue. The exact error is EPIPE, which means the
device is responding with a STALL to the SET_INTERFACE request. Devices are
free to respond with a STALL if there is only one alternate setting, but
based on the description you attached this isn't the case (at least for
bInterfaceNumber == 6).

Chris
Post by Dennis Muhlestein
I'm working on a device that has multiple interfaces. Some of the
interfaces have 0 bandwidth alt setting 0 w/ an alt 1 that has the
endpoints. On Linux (Fedora 25) There are some of these alt 1 interfaces
that fail to be claimed. I can use pyusb and try to set each interface alt
setting and see some succeed and some fail. I can't find much difference
between the interfaces other than which endpoints are included. I'm not
getting any kernel debug info in dmesg providing a hint as to whats wrong,
just the error 32 as seen by LIBUSB_DEBUG=4. Also, on another OS, I can
claim some of the interfaces that are failing on Linux. Any thoughts how I
can debug to find out where this problem is occurring? I don't know if it's
a libusb, linux kernel or device issue. Sample log attached. (interface 4
and 5 claimed fine, but 6 fails.) Also attached interface.txt which is the
interface as seen by lsusb -v
TIA,
-Dennis
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
libusb-devel mailing list
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Alan Stern
2017-03-04 15:31:40 UTC
Permalink
Post by Dennis Muhlestein
I'm working on a device that has multiple interfaces. Some of the
interfaces have 0 bandwidth alt setting 0 w/ an alt 1 that has the
endpoints. On Linux (Fedora 25) There are some of these alt 1
interfaces that fail to be claimed. I can use pyusb and try to set
each interface alt setting and see some succeed and some fail. I
can't find much difference between the interfaces other than which
endpoints are included. I'm not getting any kernel debug info in
dmesg providing a hint as to whats wrong, just the error 32 as seen
by LIBUSB_DEBUG=4. Also, on another OS, I can claim some of the
interfaces that are failing on Linux. Any thoughts how I can debug
to find out where this problem is occurring? I don't know if it's a
libusb, linux kernel or device issue. Sample log attached.
(interface 4 and 5 claimed fine, but 6 fails.) Also attached
interface.txt which is the interface as seen by lsusb -v
It's not easy to say exactly what's going wrong. However, it is
noteworthy tha the device's configuration is invalid -- several
endpoints belong to multiple interfaces. (For example, endpoints 1-IN
and 1-OUT both belong to interfaces 2 and 4.) The USB specification
prohibits endpoints from belonging to more than one interface in the
same configuration.

I guess that if you fix the configuration then the Set-Interface calls
will start working.

Alan Stern
Dennis Muhlestein
2017-03-09 22:56:18 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...