Browse Source

Add add_report_raw method to append raw items/bytes-likes to HID descriptor

hid
Josh Koike 4 years ago
parent
commit
8417f3684c
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      usb_protocol/emitters/descriptors/hid.py

+ 9
- 0
usb_protocol/emitters/descriptors/hid.py View File

@@ -15,6 +15,15 @@ _hid_item_length = [ 0, 1, 2, 4 ]
class HIDDescriptor(ComplexDescriptorEmitter): class HIDDescriptor(ComplexDescriptorEmitter):
DESCRIPTOR_FORMAT = HIDDescriptorType DESCRIPTOR_FORMAT = HIDDescriptorType


def add_report_raw(self, report_data):
"""Append raw report item or bytes to HID report

Arguments:
report_data -- bytes-like or ReportDescriptor to be appended to
the HID report.
"""
self._reports.append(hid_data)

def add_report_item(self, report_prefix, *report_data): def add_report_item(self, report_prefix, *report_data):
hid_report = ReportDescriptorEmitter() hid_report = ReportDescriptorEmitter()
report_len = _hid_item_length.index(len(report_data)) report_len = _hid_item_length.index(len(report_data))


Loading…
Cancel
Save