On Fri, 11 Mar 2011 19:37:36 wander.lairson wrote:
> 2011/3/10 Andrew Errington <a.erring...@lancaster.ac.uk>:
>
> [snip]
>
> > How do I do this in pyUSB?  So far I have managed to identify the device,
> > detach the driver (for interface 3, the HID interface) and I can read the
> > state of the GPIO pins (but I cannot write to them).
> >
> > Hints and tips would be welcome.
>
> What endpoint this data is sent to?

I'm not sure.  SnoopUSB tells me there is no endpoint involved (it is n/a), 
and you can see in the XML I sent it is -1, so I don't know.  I am sure it is 
supposed to be endpoint 0x83 on interface 3.

Here is the summary of the first packet from SnoopUSB.  This is the first 
packet that is sent when I set the GPIO from the test software:

Seq     Dir             Endpt   Time    Function        Data            Result
9       out down        n/a     31.341  CLASS_INTERFACE 00 01 01 00     

If I expand this packet in the SnoopUSB program I see this:

URB Header (length: 80)
SequenceNumber: 9
Function: 001b (CLASS_INTERFACE)
PipeHandle: 00000000
SetupPacket:
0000: 22 09 00 02 03 00 00 00
bmRequestType: 22
   DIR: Host-To-Device
   TYPE: Class
   RECIPIENT: Endpoint
bRequest: 09

TransferBuffer: 0x00000004 (4) length
0000: 00 01 01 00

There is no more information to be seen in this packet.  There are four 
packets in the transaction.  I assume that the following three packets are 
acknowledgement and housekeeping (they are in the XML I sent, but they 
are 'prettier' in SnoopUSB).

Here are the interfaces and endpoints.  First, a short program to print them:

dev = usb.core.find(idVendor=0x0c76, idProduct=0x160b)

for cfg in dev:
    sys.stdout.write(str(cfg.bConfigurationValue) + '\n')
    for intf in cfg:
        sys.stdout.write('\ti/f no:' + \
        str(intf.bInterfaceNumber) + \
        ',' + \
        str(intf.bAlternateSetting) + \
        '\n')
        for ep in intf:
            sys.stdout.write('\t\te/p addr:' + \
            str(hex(ep.bEndpointAddress)) + \
            '\n')

Here is the output:

1
        i/f no:0,0
        i/f no:1,0
        i/f no:1,1
                e/p addr:0x1
        i/f no:2,0
        i/f no:2,1
                e/p addr:0x82
        i/f no:3,0
                e/p addr:0x83


What should I look for/try next?

Thanks,

Andrew

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to