[libhid-discuss] Still can't interrupt_read() properly

Marian Aldenhövel marian.aldenhoevel at mba-software.de
Tue Sep 9 21:34:46 UTC 2008


Hi,

Thank you very much for bearing with me.

> Please make sure you read all the bytes from interrupt endpoint in multiples of 64.

Now that is a very interesting bit of information.

 > lsusb -vvv will give info reagrding the size of interrupt
 > endpoint descriptor.

I have attached my lsusb -vvv output and would appreciate help. I have so far 
interpreted the report information given in these Stanzas:

 >Item(Local ): Usage, data= [ 0x60 0x01 ] 352
 >                            (null)
 >            Item(Main  ): Input, data= [ 0x02 0x01 ] 258
 >                            Data Variable Absolute No_Wrap Linear
 >Buffered Bytes
 >            Item(Main  ): End Collection, data=none
 >            Item(Local ): Usage, data= [ 0x61 ] 97
 >                            (null)
 >            Item(Main  ): Collection, data= [ 0x02 ] 2
 >                            Logical
 >            Item(Global): Report ID, data= [ 0x42 ] 66
 >            Item(Global): Report Size, data= [ 0x08 ] 8
 >            Item(Global): Report Count, data= [ 0x0b 0x00 ] 11

So when I expect less than 11 bytes I read 11. Because I thought this was a 
fixed size for the reportID given and some layer of the USB protocol would 
require messages to be of these predefined sizes.

I do not pretend to understand this stuff, so I have extrapolated from 
sending: I build my command in a buffer (the device has a command-protocol 
inherited from the version connected by RS-232), then look up the ReportID 
that is next larger than the packet. Pad the packet with zeroes to the size of 
the report. Prepend the ReportID I found and send it.

And this has worked so far. The device acts on the commands I send, some of 
them lead to physically noticeable results.

So I thought I'd do the same in reverse when reading the responses the device 
is supposed to give to each command.

I would very much like to be corrected. I do have a sort-of-working kludge now 
(I just go on reading repeatedly. After a number of INT_READ_FAILED and 
TIMEOUTs it finally answers. Takes ages, but is not really a timing issue, 
because if I wait for a long time before trying the problem is the same), but 
doing it correctly would make me feel much much much better.

Ciao, MM
-- 
Marian Aldenhövel, Rosenhain 23, 53123 Bonn
http://www.marian-aldenhoevel.de
"I ran some quick calculations on it. He's about 80% on the right
  track.  That leaves him only 20% dead when he crashes." Bob C
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lsusb.txt
Url: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20080909/020c1245/attachment-0001.txt 


More information about the libhid-discuss mailing list