Re: [ANN] HID report descriptor library and tool

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

 



On Tue, Mar 2, 2010 at 4:09 PM, Nikolai Kondrashov <spbnick@xxxxxxxxx> wrote:
> Xiaofan Chen wrote:
>>
>> I see that you also has the hidrd-dump developed along with hidrd-convert.
>> Currently hidrd-dump (report descriptor dump utility) does not work too
>> well.
>
> Could you please explain what's wrong with it? Thanks :) Or do you mean the
> problem is that it doesn't dump the device descriptors itself?

It is not working well basically for some device.
I think it is based on libhid which does not detach the 2nd interface
if the device is a USB composite device.

Eg: I have a few HID device now.

mcuee@ubuntu64:~/Desktop$ lsusb
Bus 001 Device 011: ID 04d8:0033 Microchip Technology, Inc. (PICkit 2)
Bus 001 Device 008: ID 046d:c216 Logitech, Inc. Dual Action Gamepad
Bus 002 Device 007: ID 046d:c054 Logitech, Inc. (Mouse)
Bus 002 Device 003: ID 04f2:0760 Chicony Electronics Co., Ltd  (Acer Keyboard).

The first three are good. The last one is a USB composite
device and only one interface is dumped.

mcuee@ubuntu64:~/Desktop$ hidrd-dump 046d c216
 05 01 09 04 A1 01 A1 02 15 00 26 FF 00 35 00 46
 FF 00 75 08 95 04 09 30 09 31 09 32 09 35 81 02
 25 07 46 3B 01 75 04 95 01 65 14 09 39 81 42 65
 00 25 01 45 01 75 01 95 0C 05 09 19 01 29 0C 81
 02 06 00 FF 75 01 95 10 25 01 45 01 09 01 81 02
 C0 A1 02 26 FF 00 46 FF 00 75 08 95 07 09 02 91
 02 C0 A1 02 26 FF 00 46 FF 00 75 08 95 05 06 00
 FF 09 01 B1 02 C0 C0

mcuee@ubuntu64:~/Desktop$ hidrd-dump 04d8 0033
 06 00 FF 09 01 A1 01 19 01 29 40 15 00 26 FF 00
 75 08 95 40 81 02 19 01 29 40 91 02 C0

mcuee@ubuntu64:~/Desktop$ hidrd-dump 046d c054
 05 01 09 02 A1 01 09 01 A1 00 05 09 19 01 29 08
 15 00 25 01 75 01 95 08 81 02 05 01 16 01 F8 26
 FF 07 75 0C 95 02 09 30 09 31 81 06 15 81 25 7F
 75 08 95 01 09 38 81 06 05 0C 0A 38 02 95 01 81
 06 C0 C0

mcuee@ubuntu64:~/Desktop$ hidrd-dump 04f2 0760
 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01
 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06
 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00
 C0

The last one should be something like this.
http://www.microchip.com/forums/fb.aspx?m=377479

>> If possible, combining these two so that we can get the report
>> descriptor of an existing device and convert it to the XML or other
>> format.
>
> Well, I don't think a separate program is really needed for this.
> You could write a simple script to do it, like this one:
>
> #!/bin/sh
> hidrd-dump "$@" | tr -d ' \n' | xxd -r -p | hidrd-convert -o xml
>
> xxd is packaged with vim, if you don't have it.
>

Thanks. This seems to work.

The following is for PICkit 2, an HID programmer from Microchip
(http://www.microchip.com/pickit2).
mcuee@ubuntu64:~/Desktop$ dumphidrd.sh 04d8 0033
<?xml version="1.0"?>
<descriptor xmlns="http://digimend.sourceforge.net";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://digimend.sourceforge.net hidrd.xsd">
  <usage_page>FF00<!-- Vendor-defined --></usage_page>
  <usage>01<!-- Top-level --></usage>
  <COLLECTION type="application">
    <usage_minimum>01<!-- Top-level --></usage_minimum>
    <usage_maximum>40</usage_maximum>
    <logical_minimum>0</logical_minimum>
    <logical_maximum>255</logical_maximum>
    <report_size>8</report_size>
    <report_count>64</report_count>
    <input>
      <variable/>
    </input>
    <usage_minimum>01<!-- Top-level --></usage_minimum>
    <usage_maximum>40</usage_maximum>
    <output>
      <variable/>
    </output>
  </COLLECTION>
</descriptor>

mcuee@ubuntu64:~/Desktop$ dumphidrd.sh  04f2 0760
<?xml version="1.0"?>
<descriptor xmlns="http://digimend.sourceforge.net";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://digimend.sourceforge.net hidrd.xsd">
  <usage_page>desktop<!-- Generic desktop controls --></usage_page>
  <usage>desktop_keyboard<!-- Keyboard (06, top-level) --></usage>
  <COLLECTION type="application">
    <usage_page>keyboard<!-- Keyboard/keypad --></usage_page>
    <usage_minimum>keyboard_kb_leftcontrol<!-- Keyboard left control
(E0) --></usage_minimum>
    <usage_maximum>keyboard_kb_right_gui<!-- Keyboard right GUI (E7)
--></usage_maximum>
    <logical_minimum>0</logical_minimum>
    <logical_maximum>1</logical_maximum>
    <report_size>1</report_size>
    <report_count>8</report_count>
    <input>
      <variable/>
    </input>
    <report_count>1</report_count>
    <report_size>8</report_size>
    <input>
      <constant/>
    </input>
    <report_count>3</report_count>
    <report_size>1</report_size>
    <usage_page>led<!-- LEDs --></usage_page>
    <usage_minimum>01<!-- Top-level --></usage_minimum>
    <usage_maximum>03<!-- Top-level --></usage_maximum>
    <output>
      <variable/>
    </output>
    <report_count>5</report_count>
    <report_size>1</report_size>
    <output>
      <constant/>
    </output>
    <report_count>6</report_count>
    <report_size>8</report_size>
    <logical_minimum>0</logical_minimum>
    <logical_maximum>255</logical_maximum>
    <usage_page>keyboard<!-- Keyboard/keypad --></usage_page>
    <usage_minimum>keyboard_none<!-- No event (00) --></usage_minimum>
    <usage_maximum>FF</usage_maximum>
    <input/>
  </COLLECTION>
</descriptor>

The real report descriptor should be something like this.
http://www.microchip.com/forums/fb.aspx?m=377479 (lsusb, Linux)
http://www.microchip.com/forums/fb.aspx?m=367960 (HHD, Windows)

Somehow I prefer the plain text version like the one from lsusb.

-- 
Xiaofan http://mcuee.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux