On Tue, Oct 29, 2013 at 08:13:45PM -0200, Wander Lairson Costa wrote:
> 2013/10/29 Tormod Volden <lists.tor...@gmail.com>:
> > On Tue, Oct 29, 2013 at 9:06 PM, Wander Lairson Costa wrote:
> >> 2013/10/29 Johannes Stezenbach:
> >>> On Tue, Oct 29, 2013 at 02:58:45PM -0200, Wander Lairson Costa wrote:
> >>>> 2013/10/29 Johannes Stezenbach:
> >>> We're running in cirecles... maybe I don't understand
> >>> what the (0,0) index in cfg[(0,0)] means?  My assumption
> >>> is it means the first Interface Descriptor as listed
> >>> in lsusb -v output.
> >>>
> >>> And if the first descriptor has bInterfaceNumber==2 and
> >>> you look it up with usb.util.find_descriptor() you would
> >>> get the same first descriptor.
> >>>
> >>
> >> I am affraid you are confusing the relative order in which the
> >> interface descriptor appears inside a configuration descriptor (which
> >> is irrelevant to USB spec), and the interface number, which is
> >> actually used for USB, say, for interface claiming. They are not
> >> necessarily equal...
> >
> > No, he is not. He is just saying that the code in question will simply
> > look up the first (in appearing order) interface, whatever its
> > interface number is. So the question is why go via the interface
> > number in this example.
> >
> 
> Ah, now I got it, thanks Tormod. It is needed because because we want
> the interface descriptor related to the current active alternate
> setting for the first interface found.

I'm still not getting it.

    cfg = dev.get_active_configuration()
    # now we have the Configuration Descriptor for some arbitrary configuration
    intf = cfg[(0,0)]
    # first altsetting of first interface in the configuration

The usb.util.find_descriptor() in the tutorial would be useful
if we would know bInterfaceNumber for the desired interface
by some other means.  A more realistic example for the
tutorial would search the interface by bInterfaceClass,
bInterfaceSubClass and bInterfaceProtocol.  Or, for the
case of Linux g_zero, find the configuration with
iConfiguration pointing to "source and sink data" and
use the first (and only) interface.


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