On Tue, Oct 29, 2013 at 06:06:43PM -0200, Wander Lairson Costa wrote:
> 2013/10/29 Johannes Stezenbach <j...@sig21.net>:
> > On Tue, Oct 29, 2013 at 02:58:45PM -0200, Wander Lairson Costa wrote:
> >
> > I was testing with a Linux based device and gadget g_zero, and
> > the EPIPE error stuck unless I added either intf.set_altsetting()
> > or explicit CLEAR_FEATURE(ENDPOINT_STALL).  I remember having read
> > both SET_INTERFACE and SET_CONFIGURATION should reset the endpoint state
> > including data toggles and any device FIFOs, but I'm not sure
> > where I read it.  Might have been Cypress FX2 documentation.
> >
> 
> This probably is device specific, that's the reason is real hard to
> have generic sample code that will work for you, and that's because I
> chose to post minimum code snippets in the tutorial.

OK, it looks like a bug in the PCD (peripheral controller driver)
which does not clear STALL in usb_ep_enable().  Thus I was
confused and the intf.set_altsetting() is not needed,
dev.set_configuration() is sufficient.


> >> >> > [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


Thanks,
Johannes

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to