D
D
Dmitry2016-03-09 20:41:35
C++ / C#
Dmitry, 2016-03-09 20:41:35

What is wrong with the HID descriptor?

Good day to all.
For an hour I've been toiling over the problem with the HID descriptor. There is a HID Report Descriptor:

const uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC] =
  {
    0x06, 0xff, 0x00,      /* USAGE_PAGE (Vendor Page: 0x00FF) */
    0x09, 0x01,            /* USAGE (Demo Kit)                 */
    0xa1, 0x01,            /* COLLECTION (Application)         */
    /* 7 */

        0xa1, 0x03,            /*   COLLECTION (Report 1) */
            /* Data, device --> host (INPUT) */
            0x85, 0x01,                         /*     REPORT_ID (1)              */
            0x09, 0x01,                         /*     USAGE (DATA TO HOST)       */
            0x15, 0x00,                         /*     LOGICAL_MINIMUM (0)        */
            0x26, 0xff, 0xff,                   /*     LOGICAL_MAXIMUM (65535)    */
            0x75, 0x10,                         /*     REPORT_SIZE (16)           */
            0x95, 0x01,                         /*     REPORT_COUT (1)            */
            0x81, 0x02,                         /*     INPUT (Data,Var,Abs)       */
        0xc0, 	               /*   END_COLLECTION      */
    /* 25 */

        0xa1, 0x03,            /*   COLLECTION (Report 2) */
            /* Current mode, device --> host (INPUT) */
            0x85, 0x02,                         /*     REPORT_ID (2)              */
            0x09, 0x02,                         /*     USAGE (MODE TO HOST)       */
            0x75, 0x08,                         /*     REPORT_SIZE (8)            */
            0x95, 0x01,                         /*     REPORT_COUT (1)            */
            0x15, 0x00,                         /*     LOGICAL_MINIMUM (0)        */
            0x26, 0x00, 0x07,                   /*     LOGICAL_MAXIMUM (7)        */
            0xb1, 0x82,                         /*     FEATURE (Data,Var,Abs,Vol) */
        0xc0, 	               /*   END_COLLECTION      */
    /* 43 */

        0xa1, 0x03,            /*   COLLECTION (Report 3) */
            /* Table, device <-- host (OUTPUT) */
            0x85, 0x03,                         /*     REPORT_ID (3)              */
            0x09, 0x03,                         /*     USAGE (TABLE TO DEVICE)    */
            0x75, 0x10,                         /*     REPORT_SIZE (16)           */
            0x95, 0x02,                         /*     REPORT_COUT (2)            */
            0x15, 0x00,                         /*     LOGICAL_MINIMUM (0)        */
            0x26, 0xff, 0xff,                   /*     LOGICAL_MAXIMUM (65535)    */
            0xb1, 0x82,                         /*     FEATURE (Data,Var,Abs,Vol) */
        0xc0, 	               /*   END_COLLECTION      */
    /* 61 */

        0xa1, 0x03,            /*   COLLECTION (Report 4) */
            /* Required mode, device <-- host (OUTPUT) */
            0x85, 0x04,                         /*     REPORT_ID (4)              */
            0x09, 0x04,                         /*     USAGE (MODE TO DEVICE)     */
            0x75, 0x08,                         /*     REPORT_SIZE (8)            */
            0x95, 0x01,                         /*     REPORT_COUT (1)            */
            0x15, 0x00,                         /*     LOGICAL_MINIMUM (0)        */
            0x26, 0x00, 0x07,                   /*     LOGICAL_MAXIMUM (7)        */
            0xb1, 0x82,                         /*     FEATURE (Data,Var,Abs,Vol) */
        0xc0, 	               /*   END_COLLECTION      */
    /* 79 */

        0xa1, 0x03,            /*   COLLECTION (Report 5) */
            /* CRC and angles, device --> host (INPUT) */
            0x85, 0x05,                         /*     REPORT_ID (5)              */
            0x09, 0x05,                         /*     USAGE (CRC TO HOST)        */
            0x75, 0x10,                         /*     REPORT_SIZE (16)           */
            0x95, 0x02,                         /*     REPORT_COUT (2)            */
            0x15, 0x00,                         /*     LOGICAL_MINIMUM (0)        */
            0x26, 0xff, 0xff,                   /*     LOGICAL_MAXIMUM (65535)    */
            0xb1, 0x82,                         /*     FEATURE (Data,Var,Abs,Vol) */
            0x85, 0x05,                         /*     REPORT_ID (5)              */
            0x09, 0x05,                         /*     USAGE (CRC TO HOST)        */
            0x81, 0x02,                         /*     INPUT (Data,Var,Abs)       */
        0xc0, 	               /*   END_COLLECTION      */
    /* 97 */

    0xc0 	               /*     END_COLLECTION               */
    /* 98 */
  }; /* CustomHID_ReportDescriptor */

For some reason, when I change any of these two fields
0x75, 0x10,                         /*     REPORT_SIZE (16)           */
0x95, 0x02,                         /*     REPORT_COUT (2)            */

one of Report 5 or Report 1, then the size changes for both when I receive packets on the host. Moreover, these packages are empty, i.e. Raw data is not displayed there at all. I use USBLyzer for debugging.
00985bdfd8eb4d7b87e08c2a71b3195b.png
What's wrong? I suspect that the problem is in the clumsiness of the descriptor written by me.
UPD1: I missed something - if I change REPORT 5, then REPORT 1 changes with it, but not vice versa.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question