I am trying to make a HID USB keyboard. The default HID descriptor has a 6-key HID report. Here is the descriptor, and I have tested it working:
static const uint8 hid_descriptor_keyboard[] = {
/****/ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
/****/ 0x09, 0x06, /* USAGE (Keyboard) */
/****/ 0xa1, 0x01, /* COLLECTION (Application) */
/******/ 0x05, 0x07, /* USAGE_PAGE (Keyboard) */
/******/ 0x85, 0x01, /* REPORT_ID (1) */
/* Ctrl, Shift and other modifier keys, 8 in total */
/******/ 0x19, 0xe0, /* USAGE_MINIMUM (kbd LeftControl) */
/******/ 0x29, 0xe7, /* USAGE_MAXIMUM (kbd Right GUI) */
/******/ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
/******/ 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
/******/ 0x75, 0x01, /* REPORT_SIZE (1) */
/******/ 0x95, 0x08, /* REPORT_COUNT (8) */
/******/ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
/* Reserved byte */
/******/ 0x95, 0x01, /* REPORT_COUNT (1) */
/******/ 0x75, 0x08, /* REPORT_SIZE (8) */
/******/ 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */
/* LEDs for num lock etc */
/******/ 0x95, 0x05, /* REPORT_COUNT (5) */
/******/ 0x75, 0x01, /* REPORT_SIZE (1) */
/******/ 0x05, 0x08, /* USAGE_PAGE (LEDs) */
/******/ 0x85, 0x01, /* REPORT_ID (1) */
/******/ 0x19, 0x01, /* USAGE_MINIMUM (Num Lock) */
/******/ 0x29, 0x05, /* USAGE_MAXIMUM (Kana) */
/******/ 0x91, 0x02, /* OUTPUT (Data,Var,Abs) */
/* Reserved 3 bits */
/******/ 0x95, 0x01, /* REPORT_COUNT (1) */
/******/ 0x75, 0x03, /* REPORT_SIZE (3) */
/******/ 0x91, 0x03, /* OUTPUT (Cnst,Var,Abs) */
/* Slots for 6 keys that can be pressed down at the same time */
/******/ 0x95, 0x06, /* REPORT_COUNT (6) */
/******/ 0x75, 0x08, /* REPORT_SIZE (8) */
/******/ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
/******/ 0x25, 0x65, /* LOGICAL_MAXIMUM (101) */Bluegiga Technologies Oy
/******/ 0x05, 0x07, /* USAGE_PAGE (Keyboard) */
/******/ 0x19, 0x00, /* USAGE_MINIMUM (Reserved (no event indicated)) */
/******/ 0x29, 0x65, /* USAGE_MAXIMUM (Keyboard Application) */
/******/ 0x81, 0x00, /* INPUT (Data,Ary,Abs) */
/****/ 0xc0
Now, I would like to change this from a 6-key descriptor to a 7-key descriptor. I believe this is the relevant portion of the descriptor:
/* Slots for 6 keys that can be pressed down at the same time */
/******/ 0x95, 0x06, /* REPORT_COUNT (6) */
/******/ 0x75, 0x08, /* REPORT_SIZE (8) */
/******/ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
/******/ 0x25, 0x65, /* LOGICAL_MAXIMUM (101) */
So to change it to 7-key, I made the REPORT_COUNT to 7:
/* Slots for 6 keys that can be pressed down at the same time */
/******/ 0x95, 0x07, /* REPORT_COUNT (7) */
/******/ 0x75, 0x08, /* REPORT_SIZE (8) */
/******/ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
/******/ 0x25, 0x65, /* LOGICAL_MAXIMUM (101) */
Now moving on to test it. Previously, this would be the HID report to send ";abcde" to the computer using the 6-key descriptor:
0x9f 0x0a 0xa1 0x01 0x00 0x00 0x33 0x04 0x05 0x06 0x07 0x08
Since I am using a 7-key descriptor, the new HID report is this:
0x9f 0x0b 0xa1 0x01 0x00 0x00 0x33 0x04 0x05 0x06 0x07 0x08 0x09
Note that the length is now 0x0b (11) instead of 0x0a (10), and I added the 0x09. The expected keyboard result should be ";abcdef", however I only receive ";abcde", just like before.
Why is my 7-key HID descriptor not working? Thanks!