Hello to all!
I am trying to implement a device that can send keys from the code table 0x07 and a context menu key to the device.
Here is my descriptor:
{
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
0x05, 0x08, // Usage Page (Page# for LEDs)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x05, // Usage Maximum (5)
0x91, 0x02, // Output (Data, Variable, Absolute), Led report
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x91, 0x01, // Output (Data, Variable, Absolute), Led report padding
0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x25, 0xFF, // Logical Maximum (255)
0x05, 0x07, // Usage Page (Key codes)
0x19, 0x00, // Usage Minimum (0)
0x29, 0xFF, // Usage Maximum (255)
0x81, 0x00, // Input (Data, Array) Key array(6 bytes)
0xC0, // End Collection (Application)
0x05, 0x01, // Usage Page (Desktop),
0x09, 0x80, // Usage (Sys Control),
0xA1, 0x01, // Collection (Application),
0x85, 0x01, // Report ID (1),
0x19, 0x81, // Usage Minimum (Sys Power Down),
0x29, 0x88, // Usage Maximum (System Menu Exit),
0x15, 0x00, // Logical Minimum (0),
0x25, 0x01, // Logical Maximum (1),
0x95, 0x08, // Report Count (8),
0x75, 0x01, // Report Size (1),
0x81, 0x02, // Input (Variable),
0xC0, // End Collection,
};
The first part of the descriptor consists of 7 bytes,
1st byte for the opposite answer for LEDs, the remaining 6 bytes is a set of keys from the code table 0x07
The second part is 1 byte for sending system commands, in general I need only 1 bit is the context menu. But I decided not to limit myself to this.
Now about sending:
I am using a function from nordic
err_code = ble_hids_inp_rep_send(p_hids,
INPUT_REPORT_KEYS_INDEX,
INPUT_REPORT_KEYS_MAX_LEN,
data,
m_conn_handle);
INPUT_REPORT_KEYS_MAX_LEN = 7
INPUT_REPORT_KEYS_INDEX = 0
I want to send only the context menu key, for this, I pass [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (1 << 3)] to the data, where (1 << 3) bits the context menu command.
But unfortunately, this does not work. Most likely the error in the descriptor, but I do not have enough experience to understand what the error is. Also, I don’t know how to debug this on the phone side except for Key event viewer
Thanks!