Discussion:
[Libusb-devel] set_configuration: device or resource busy
Chris Frey
2005-12-29 18:17:02 UTC
Permalink
Hi,

I received the following bug report on a call to libusb_set_configuration():

Libusb: [libusb_set_configuration:82] could not set config 1: Device or
resource busy

This happens after a successful call to libusb_claim_interface().

On searching the web I came across this bug report:

https://alioth.debian.org/tracker/index.php?func=detail&aid=302207&group_id=30186&atid=410366

... which states that the programmer ignores EBUSY errors from a
usb_set_configuration() call. The assumption being that the kernel or some
other module has already set the configuration.

Is this the correct fix?

Thanks,
- Chris
Charles Lepple
2005-12-29 20:54:01 UTC
Permalink
Post by Chris Frey
Hi,
Libusb: [libusb_set_configuration:82] could not set config 1: Device or
resource busy
This happens after a successful call to libusb_claim_interface().
Wasn't there a discussion just recently on libusb-devel about this? (I
can't seem to find it in the list archives.)

IIRC, setting the configuration can change the available interfaces,
so it would seem that if you need to select an alternate
configuration, you need to do so before claiming an interface.

--
- Charles Lepple
Chris Frey
2005-12-29 21:21:02 UTC
Permalink
Post by Charles Lepple
Post by Chris Frey
Libusb: [libusb_set_configuration:82] could not set config 1: Device or
resource busy
This happens after a successful call to libusb_claim_interface().
Wasn't there a discussion just recently on libusb-devel about this? (I
can't seem to find it in the list archives.)
If there was, I missed it.
Post by Charles Lepple
IIRC, setting the configuration can change the available interfaces,
so it would seem that if you need to select an alternate
configuration, you need to do so before claiming an interface.
Isn't the claim_interface function a kernel-level thing?

I was going by the old documentation at
http://libusb.sourceforge.net/doc/function.usbclaiminterface.html

which says that claim_interface must be called before doing any related
operations.

This could be the source of my confusion though... thanks for the
reply!

- Chris
Charles Lepple
2005-12-30 20:02:01 UTC
Permalink
Post by Chris Frey
Post by Charles Lepple
Post by Chris Frey
Libusb: [libusb_set_configuration:82] could not set config 1: Device or
resource busy
This happens after a successful call to libusb_claim_interface().
Wasn't there a discussion just recently on libusb-devel about this? (I
can't seem to find it in the list archives.)
If there was, I missed it.
In the thread "Nokia SU-1B driver development", this link was mentioned:

http://www.vmware.com/community/thread.jspa?threadID=26099&tstart=90

and someone points out a change in 2.6.13.x which requires you to
release a claimed interface before changing the configuration.
Post by Chris Frey
Post by Charles Lepple
IIRC, setting the configuration can change the available interfaces,
so it would seem that if you need to select an alternate
configuration, you need to do so before claiming an interface.
Isn't the claim_interface function a kernel-level thing?
I was going by the old documentation at
http://libusb.sourceforge.net/doc/function.usbclaiminterface.html
which says that claim_interface must be called before doing any related
operations.
not to nitpick, but it says "before you perform any operations
*related to this interface*".

Eventually, someone might make me feel guilty enough to read this part
of the actual USB spec again, but Jan Axelson's USB Complete basically
says that each configuration descriptor specifies the number of
interfaces supported by that configuration, and that the interface
descriptors are "subordinate" to the configuration descriptor.

The new behavior of the kernel makes it easier to check whether
someone has claimed a valid interface, since it does not allow you to
change the configuration when any interface is already claimed.
(Admittedly, it is probably not very common to claim an interface,
then select a new configuration where the old interface no longer
exists...)

--
- Charles Lepple
Chris Frey
2005-12-30 20:24:02 UTC
Permalink
Post by Charles Lepple
not to nitpick, but it says "before you perform any operations
*related to this interface*".
You're right.
Post by Charles Lepple
Eventually, someone might make me feel guilty enough to read this part
of the actual USB spec again, but Jan Axelson's USB Complete basically
says that each configuration descriptor specifies the number of
interfaces supported by that configuration, and that the interface
descriptors are "subordinate" to the configuration descriptor.
The new behavior of the kernel makes it easier to check whether
someone has claimed a valid interface, since it does not allow you to
change the configuration when any interface is already claimed.
(Admittedly, it is probably not very common to claim an interface,
then select a new configuration where the old interface no longer
exists...)
Thanks very much for the explanation. I had it bass ackwards.

- Chris

Continue reading on narkive:
Loading...