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

amruth amruth_pv at yahoo.com
Tue Sep 9 22:18:41 UTC 2008


Hi
Please send your wMaxPacketSize for interrupt descriptor.

For example it is like this
Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0004  bytes 4 once
        bInterval              12


Thanks
Amruth p.v


--- On Tue, 9/9/08, Marian Aldenhövel <marian.aldenhoevel at mba-software.de> wrote:

> From: Marian Aldenhövel <marian.aldenhoevel at mba-software.de>
> Subject: Re: [libhid-discuss] Still can't interrupt_read() properly
> To: "libhid-discuss List" <libhid-discuss at lists.alioth.debian.org>
> Date: Tuesday, September 9, 2008, 4:34 PM
> 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
> 
> Bus 001 Device 006: ID 0590:0034 Omron Corp. 
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0        64
>   idVendor           0x0590 Omron Corp.
>   idProduct          0x0034 
>   bcdDevice            1.04
>   iManufacturer           1 OMRON Corporation
>   iProduct                4 V4KU-01JF-001       
>   iSerial                 3 420172
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           34
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          2 Default
>     bmAttributes         0xc0
>       Self Powered
>     MaxPower              100mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         3 Human Interface Device
>       bInterfaceSubClass      0 No Subclass
>       bInterfaceProtocol      0 None
>       iInterface              0 
>         HID Device Descriptor:
>           bLength                 9
>           bDescriptorType        33
>           bcdHID               1.11
>           bCountryCode            0 Not supported
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength     337
>           Report Descriptor: (length is 337)
>             Item(Global): Usage Page, data= [ 0x00 0xff ]
> 65280
>                             (null)
>             Item(Local ): Usage, data= [ 0x01 ] 1
>                             (null)
>             Item(Main  ): Collection, data= [ 0x01 ] 1
>                             Application
>             Item(Global): Logical Minimum, data= [ 0x00 ] 0
>             Item(Global): Logical Maximum, data= [ 0xff
> 0x00 ] 255
>             Item(Local ): Usage, data= [ 0x20 ] 32
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x01 ] 1
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x03 0x00 ]
> 3
>             Item(Local ): Usage, data= [ 0x20 0x01 ] 288
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x21 ] 33
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x02 ] 2
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x0b 0x00 ]
> 11
>             Item(Local ): Usage, data= [ 0x21 0x01 ] 289
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x22 ] 34
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x03 ] 3
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x13 0x00 ]
> 19
>             Item(Local ): Usage, data= [ 0x22 0x01 ] 290
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x23 ] 35
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x04 ] 4
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x23 0x00 ]
> 35
>             Item(Local ): Usage, data= [ 0x23 0x01 ] 291
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x24 ] 36
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x05 ] 5
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x4b 0x00 ]
> 75
>             Item(Local ): Usage, data= [ 0x24 0x01 ] 292
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x25 ] 37
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x06 ] 6
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x8b 0x00 ]
> 139
>             Item(Local ): Usage, data= [ 0x25 0x01 ] 293
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x26 ] 38
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x07 ] 7
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x0b 0x01 ]
> 267
>             Item(Local ): Usage, data= [ 0x26 0x01 ] 294
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x27 ] 39
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x08 ] 8
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x73 0x01 ]
> 371
>             Item(Local ): Usage, data= [ 0x27 0x01 ] 295
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x28 ] 40
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x09 ] 9
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x13 0x08 ]
> 2067
>             Item(Local ): Usage, data= [ 0x28 0x01 ] 296
>                             (null)
>             Item(Main  ): Output, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x60 ] 96
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x41 ] 65
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x03 0x00 ]
> 3
>             Item(Local ): Usage, data= [ 0x60 0x01 ] 352
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile 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
>             Item(Local ): Usage, data= [ 0x61 0x01 ] 353
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x62 ] 98
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x43 ] 67
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x13 0x00 ]
> 19
>             Item(Local ): Usage, data= [ 0x62 0x01 ] 354
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x63 ] 99
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x44 ] 68
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x23 0x00 ]
> 35
>             Item(Local ): Usage, data= [ 0x63 0x01 ] 355
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x64 ] 100
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x45 ] 69
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x4b 0x00 ]
> 75
>             Item(Local ): Usage, data= [ 0x64 0x01 ] 356
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x65 ] 101
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x46 ] 70
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x8b 0x00 ]
> 139
>             Item(Local ): Usage, data= [ 0x65 0x01 ] 357
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x66 ] 102
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x47 ] 71
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x0b 0x01 ]
> 267
>             Item(Local ): Usage, data= [ 0x66 0x01 ] 358
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x67 ] 103
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x48 ] 72
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x73 0x01 ]
> 371
>             Item(Local ): Usage, data= [ 0x67 0x01 ] 359
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x68 ] 104
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report ID, data= [ 0x49 ] 73
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0xf3 0x03 ]
> 1011
>             Item(Local ): Usage, data= [ 0x68 0x01 ] 360
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 0x01 ] 258
>                             Data Variable Absolute No_Wrap
> Linear
>                             Preferred_State
> No_Null_Position Non_Volatile Buffered Bytes
>             Item(Main  ): End Collection, data=none
>             Item(Main  ): End Collection, data=none
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval              20
> Device Status:     0x0000
>   (Bus Powered)
> _______________________________________________
> libhid-discuss mailing list
> libhid-discuss at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss


      




More information about the libhid-discuss mailing list