2013-10-31 3:58 GMT-02:00 Johannes Stezenbach <j...@sig21.net>:
> On Wed, Oct 30, 2013 at 09:24:11PM -0200, Wander Lairson Costa wrote:
>> 2013/10/30 Johannes Stezenbach <j...@sig21.net>:
>>
>> >> >> >> > [2249737.372143] usb 1-1.1: usbfs: process 32478 (python) did not 
>> >> >> >> > claim interface 0 before use
>> >> >> >> >
>> >> >> >>
>> >> >> >> Interface claiming, in another hand, is handled internally by PyUSB,
>> >> >> >> this might be a bug.
>> >> >> >
>> >> >> > usb.control.get_interface() does not claim the interface.
>> >> >> >
>> >> >>
>> >> >> Ah, no because control requests against endpoint 0 does not need
>> >> >> interface claiming.
>> >> >
>> >> > So I wonder what cause the kernel to complain.
>> >> >
>> >>
>> >> Maybe it is just a debug info without real meaning...
>> >
>> > I tried again and the
>> >     alternate_setting = usb.control.get_interface(dev, interface_number)
>> > line in the tutorial causes the Linux kernel warning (Linux 3.10.14).
>> >
>> > So it seems the Linux kernel disagrees with your assumption?
>> > If the control request is for USB_RECIP_INTERFACE it checks if
>> > the interface has been claimed:
>> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/devio.c#n765
>> >
>> >
>>
>> I don't have time right now, but I need to look further into this, as
>> it might be a problem with PyUSB. Thanks to pointing this out.
>> For now, what if you explicitly claim the interface (with
>> usb.util.claim_interface function) before calling get_interface?
>
> It works.  And intf.set_altsetting() also claims the interface,
> that's what I've been using.
>

It has been a very very long time, but finally I could go into this,
and you are right, when issuing a control request to an interface, I
must claim it.
I just pushed a fix [1]. Thanks for point me out this.

[1] 
https://github.com/walac/pyusb/commit/4c7d9a94c25a732c62db4515376bd90798a483d8


-- 
Best Regards,
Wander Lairson Costa

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to