NicoHood / HID

Bring enhanced HID functions to your Arduino!
http://www.nicohood.de
MIT License
2.33k stars 401 forks source link

RawHID Feature Report not working due to missing Feature Report in the HID Report Descriptor #418

Open mcuee opened 1 year ago

mcuee commented 1 year ago

Reference: https://github.com/todbot/hidapitester/issues/20

Minor change is needed for the HID Report Descriptor to add Feature Report https://github.com/NicoHood/HID/blob/master/src/SingleReport/RawHID.cpp

static const uint8_t  _hidReportDescriptorRawHID[] PROGMEM = {
    /*    RAW HID */
    0x06, lowByte(RAWHID_USAGE_PAGE), highByte(RAWHID_USAGE_PAGE),      /* 30 */
    0x0A, lowByte(RAWHID_USAGE), highByte(RAWHID_USAGE),

    0xA1, 0x01,                  /* Collection 0x01 */
    // RawHID is not multireport compatible.
    // On Linux it might work with some modifications,
    // however you are not happy to use it like that.
    //0x85, HID_REPORTID_RAWHID,             /* REPORT_ID */
    0x75, 0x08,                  /* report size = 8 bits */
    0x15, 0x00,                  /* logical minimum = 0 */
    0x26, 0xFF, 0x00,            /* logical maximum = 255 */

    0x95, RAWHID_TX_SIZE,        /* report count TX */
    0x09, 0x01,                  /* usage */
    0x81, 0x02,                  /* Input (array) */

    0x95, RAWHID_RX_SIZE,        /* report count RX */
    0x09, 0x02,                  /* usage */
    0x91, 0x02,                  /* Output (array) */

    0x95, RAWHID_RX_SIZE,        /* report count RX */
    0x09, 0x02,                  /* usage */
    0xB1, 0x02,                  /* Feature (array) */
    0xC0                         /* end collection */ 
};