Re: Report ID problem with HID-RAW interface usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> So let me see if I understand correctly (let me know yes or no on each):

> 1. You do not have documentation which tells what reports are available on
> the device.


Yes . documentation tells only that data payload will come in form
<Report ID> <Payload>
No documentation is there to tell what reports are available on device .


> 2. The number and size of reports is listed in the HID descriptor, which you
> do not want to parse in userspace. You want the kernel to do it for you
> (which is a reasonable request, as modules like hiddev already do this kind
> of parsing).

Yes . its better if kernel do it it . otherwise each application
utilising hidraw
interface will have to maintain its own parser to get this minimum information
regarding No of reports and their len .

if kernel provides this minimum info , hidraw offers a very convinient
interface to communicate with a hid device using standard
open/read/write/ioctl system calls.
and its very useful for applications which are interested in getting
raw events only from device
without dwelling much deeper into the complexities of hid specs .


> 3. You want to be able to support the future releases where the report sizes
> may change.
>

Yes. definately it is required .


> I think I'm finally getting the picture. Again, tell me yes or no on each:

> 0. You're using HID device with User-Defined data.

Yes . the device data is mostly in the form of <command > < response > .


> 1. Your device has lots of reports, which all take the same type of data.

Yes . the device has lots of inputs and output reports .
the report values are <command > < response> only .


> 2. Each report differs _only_ in its length, but the data is the same. For
> example:
>        1. If you want to send 5 bytes to the device, you use report 1, which
> is 5 bytes long
>        2. If you want to send 10 bytes to the device, you use report 2,
> which is 10 bytes long.
>        3. if you want to send 20 bytes to the device, you use report 3,
> which is 20 bytes long.
>        etc.

Yes. exactly . data  payload len is the defining parameter to
determine the report N to use .



> 4. You want to know dynamically, which report you need to use, based on the
> payload length, because
> 4a. the only difference in your reports is the payload length.
>

Yes .  Report selection should  be dynamic .

> Might I ask what kind of device this is that behaves this way?
>

it is Ipod .  i am enclosing report_descriptor and lsusb files for the same .


> For a device which uses numbered reports, the input report ID is always
> returned to read(). It's already doing what you're asking for.
>

it is ok .  read() calls returns  < report id > .


> read() is going to return one report per call to read(). It's not a stream
> interface. If your data is split across multiple reports, you'll need to
> stitch it back together on your end.
>
>

yes . i agree .


Thanx & Regards
Amit Nagal
Bus 002 Device 002: ID 05ac:1261 Apple, Inc. iPod Classic
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x05ac Apple, Inc.
  idProduct          0x1261 iPod Classic
  bcdDevice            0.01
  iManufacturer           1 Apple Inc.
  iProduct                2 iPod
  iSerial                 3 000A270013A06238
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          149
    bNumInterfaces          3
    bConfigurationValue     2
    iConfiguration          4 iPod USB Interface
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           30
        bInCollection           1
        baInterfaceNr( 0)       1
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Microphone
        bAssocTerminal          2
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          1
        bSourceID               1
        iTerminal               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                35
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            9 Discrete
        tSamFreq[ 0]         8000
        tSamFreq[ 1]        11025
        tSamFreq[ 2]        12000
        tSamFreq[ 3]        16000
        tSamFreq[ 4]        22050
        tSamFreq[ 5]        24000
        tSamFreq[ 6]        32000
        tSamFreq[ 7]        44100
        tSamFreq[ 8]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x00c0  1x 192 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay              0 Undefined
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      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.01
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     208
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      2
Device Status:     0x0000
  (Bus Powered)
report descriptor (size 208, read 208) =  
06 00 ff 09 01 a1 01 75 08 26 80 00 15 00 09 01 85 01 95 05 82 02 01 09 01 85 02 
95 09 82 02 01 09 01 85 03 95 0d 82 02 01 09 01 85 04 95 11 82 02 01 09 01 85 05 
95 19 82 02 01 09 01 85 06 95 31 82 02 01 09 01 85 07 95 5f 82 02 01 09 01 85 08 
95 c1 82 02 01 09 01 85 09 96 01 01 82 02 01 09 01 85 0a 96 81 01 82 02 01 09 01 
85 0b 96 01 02 82 02 01 09 01 85 0c 96 ff 02 82 02 01 09 01 85 0d 95 05 92 02 01 
09 01 85 0e 95 09 92 02 01 09 01 85 0f 95 0d 92 02 01 09 01 85 10 95 11 92 02 01 
09 01 85 11 95 19 92 02 01 09 01 85 12 95 31 92 02 01 09 01 85 13 95 5f 92 02 01 
09 01 85 14 95 c1 92 02 01 09 01 85 15 95 ff 92 02 01 c0

=====>[IPOD HID ]detailed :
 06 00 ff  //vendor defined usage page
 09 01 	   //vendor usage 1 
 a1 01	   //collection applicator
 75 08	   //report size
 26 80 00  //logical maximum
 15 00 	   //logical minimum
 //vendor usage -id   (2 bytes ) , report id (2 bytes ) ,  report count (2/3 bytes ) , i/p or o/p report (3 bytes ) 
 09 01 85 01 95 05 82 02 01 
 09 01 85 02 95 09 82 02 01 
 09 01 85 03 95 0d 82 02 01 
 09 01 85 04 95 11 82 02 01 
 09 01 85 05 95 19 82 02 01 
 09 01 85 06 95 31 82 02 01 
 09 01 85 07 95 5f 82 02 01 
 09 01 85 08 95 c1 82 02 01 
 09 01 85 09 96 01 01 82 02 01 
 09 01 85 0a 96 81 01 82 02 01 
 09 01 85 0b 96 01 02 82 02 01 
 09 01 85 0c 96 ff 02 82 02 01 
 09 01 85 0d 95 05 92 02 01
 09 01 85 0e 95 09 92 02 01 
 09 01 85 0f 95 0d 92 02 01 
 09 01 85 10 95 11 92 02 01 
 09 01 85 11 95 19 92 02 01 
 09 01 85 12 95 31 92 02 01 
 09 01 85 13 95 5f 92 02 01 
 09 01 85 14 95 c1 92 02 01 
 09 01 85 15 95 ff 92 02 01 
 
 c0 //end of collection 

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux