[libhid-discuss] HID_Interrupt_write reports OK, but no action on device..

Wingnut Wingnut wingnut.foss at gmail.com
Tue Sep 1 01:04:34 UTC 2009


On Mon, Aug 31, 2009 at 3:24 PM, Neil Sutton <swift_gti at msn.com> wrote:

> Hi All,
>
> I have been bashing my head against the keyboard all day trying to make my
> little USB relay work under Linux (Ubuntu Jaunty if it matters)
> I don't have a great deal of experience with linux but after some reading I
> discovered that the best way to talk to the relay (which detects as a HID
> device) was to use the libhid library.
>
>
In your reading, did you run across the USBSnoop program:
http://www.pcausa.com/Utilities/UsbSnoop/

This was tremendously helpful for me when I was trying to write my driver.
Once you start monitoring, look for the BULK_OR_INTERRUPT_TRANSFER to your
output endpoint (as you've reported by lsusb, this is endpoint 1).  Here's a
sample, and some info on dissecting it:

1 [43094 ms]  >>>  URB 11 going down  >>>
2 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
3   PipeHandle           = e79e99c8 [endpoint 0x00000001]
4  TransferFlags        = 00000002 (USBD_TRANSFER_DIRECTION_OUT,
USBD_SHORT_TRANSFER_OK)
5   TransferBufferLength = 00000040
6   TransferBuffer       = e51f12da
7   TransferBufferMDL    = 00000000
8     00000000: 03 08 81 00 00 00 00 00 00 00 00 00 00 00 00 00
9    00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10    00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
11    00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12  UrbLink              = 00000000
13 [43096 ms] UsbSnoop - MyInternalIOCTLCompletion(e2d37ddc) :
fido=ff503830, Irp=ff4719b0, Context=e7


In my case, on line 3, the PipeHandle shows that the destination is endpoint
0x01, the transfer buffer length is 0x40 bytes (64 bytes), and the
TransferBufferMDL raw data shows the information sent.  It turns out that I
had to send a control byte, length, and address as the first, second and
third byte before sending data (as described in the device datasheet).

Perhaps by snooping and replaying the traffic you can discover the operation
of the device?  Or perhaps find the manufacturers datasheet for the part and
see how the bus is used?

Wingnut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20090831/19d7ca2f/attachment-0001.htm>


More information about the libhid-discuss mailing list