Skip to content

report_id is None after parsing descriptor from USB UPS #27

@arkanoid87

Description

@arkanoid87

descriptor acquired with command

$ usbhid-dump -d 5131:2007                                                                                                                                          
001:005:000:DESCRIPTOR         1765929060.101728                                                                                                                                              
 05 84 09 04 A1 01 05 84 09 24 A1 00 85 0B 09 25                                                                                                                                              
 09 1F 75 04 95 02 15 00 25 0F 65 00 B1 03 05 85                                                                                                                                              
 09 D1 09 2C 09 8B 75 01 95 03 25 01 B1 03 95 05                                                                                                                                              
 B1 03 05 85 09 83 09 8C 09 8D 09 8E 75 18 95 04                                                                                                                                              
 67 01 10 10 00 55 00 27 FE FF FF 00 B1 03 05 84                                                                                                                                              
 09 40 75 10 95 01 67 21 D1 F0 00 55 05 27 FE FF                                                                                                                                              
 00 00 B1 03 05 85 09 67 75 18 95 01 67 01 10 10
 00 55 00 27 FE FF FF 00 B1 83 09 66 95 01 B1 82
 09 66 95 01 81 82 09 68 75 10 95 01 66 01 10 55
 00 27 FE FF 00 00 81 83 05 84 09 02 A1 02 05 85
 09 D0 09 45 09 44 09 42 75 01 95 04 25 01 81 83
 95 04 81 83 C0 C0 C0
import hid_parser

rdesc_raw = [
0x05, 0x84, 0x09, 0x04, 0xA1, 0x01, 0x05, 0x84, 0x09, 0x24, 0xA1, 0x00, 0x85, 0x0B, 0x09, 0x25,
0x09, 0x1F, 0x75, 0x04, 0x95, 0x02, 0x15, 0x00, 0x25, 0x0F, 0x65, 0x00, 0xB1, 0x03, 0x05, 0x85,
0x09, 0xD1, 0x09, 0x2C, 0x09, 0x8B, 0x75, 0x01, 0x95, 0x03, 0x25, 0x01, 0xB1, 0x03, 0x95, 0x05,
0xB1, 0x03, 0x05, 0x85, 0x09, 0x83, 0x09, 0x8C, 0x09, 0x8D, 0x09, 0x8E, 0x75, 0x18, 0x95, 0x04,
0x67, 0x01, 0x10, 0x10, 0x00, 0x55, 0x00, 0x27, 0xFE, 0xFF, 0xFF, 0x00, 0xB1, 0x03, 0x05, 0x84,
0x09, 0x40, 0x75, 0x10, 0x95, 0x01, 0x67, 0x21, 0xD1, 0xF0, 0x00, 0x55, 0x05, 0x27, 0xFE, 0xFF,
0x00, 0x00, 0xB1, 0x03, 0x05, 0x85, 0x09, 0x67, 0x75, 0x18, 0x95, 0x01, 0x67, 0x01, 0x10, 0x10,
0x00, 0x55, 0x00, 0x27, 0xFE, 0xFF, 0xFF, 0x00, 0xB1, 0x83, 0x09, 0x66, 0x95, 0x01, 0xB1, 0x82,
0x09, 0x66, 0x95, 0x01, 0x81, 0x82, 0x09, 0x68, 0x75, 0x10, 0x95, 0x01, 0x66, 0x01, 0x10, 0x55,
0x00, 0x27, 0xFE, 0xFF, 0x00, 0x00, 0x81, 0x83, 0x05, 0x84, 0x09, 0x02, 0xA1, 0x02, 0x05, 0x85,
0x09, 0xD0, 0x09, 0x45, 0x09, 0x44, 0x09, 0x42, 0x75, 0x01, 0x95, 0x04, 0x25, 0x01, 0x81, 0x83,
0x95, 0x04, 0x81, 0x83, 0xC0, 0xC0, 0xC0
]

rdesc = hid_parser.ReportDescriptor(rdesc_raw)
print(rdesc.get_input_report_size())
/home/dev/usbhid_test/.venv/lib/python3.13/site-packages/hid_parser/__init__.py:620: HIDUnsupportedWarning: Data specifies a unit or unit exponent, but we don't support those yet
  self._parse()
Traceback (most recent call last):
  File "/home/dev/usbhid_test/hello.py", line 19, in <module>
    print(rdesc.get_input_report_size())
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/dev/usbhid_test/.venv/lib/python3.13/site-packages/hid_parser/__init__.py", line 651, in get_input_report_size
    return self._get_report_size(self.get_input_items(report_id))
                                 ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/dev/usbhid_test/.venv/lib/python3.13/site-packages/hid_parser/__init__.py", line 648, in get_input_items
    return self._input[report_id]
           ~~~~~~~~~~~^^^^^^^^^^^
KeyError: None

lib version python-hid-parser@8a00dc4dba662a8fc3973dc504cd2a715ae0f9ae

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions