Mechanism to generate a dynamically sized USB HID Report

60 views Asked by At

In order to allow for sending feature reports to my device in Windows, I am using the following special HID report in my USB device. It lets me use hidapi's set_feature_request / get_feature_request from userspace programs on report ID 0xAA... And works great, but I want more!

In Linux, I can send "up to" 254 payload bytes, but in Windows I must send exactly 254 bytes. Is there a way of specifying that I want the size to be variable, and not fixed to exactly 254 bytes but allow up-to 254 bytes or a range.

static const uint8_t special_hid_desc[] = { 
    HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
    HID_USAGE      ( 0x00 ),
    HID_REPORT_SIZE ( 8 ),
    HID_COLLECTION ( HID_COLLECTION_LOGICAL ),
        HID_REPORT_COUNT ( 254 ),
        HID_REPORT_ID    ( 0xaa )
        HID_USAGE        ( 0x00 ),
        HID_FEATURE      ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,
    HID_COLLECTION_END
};
0

There are 0 answers