Hi,
I am programming with ncs v2.9.0, nrf52833 chips.
I am going to get pc keyboard led state in my custom board throutgh BLE.
This is my report map,but cannot get data from pc in "central_boot_write_cb"
#define OUTPUT_REPORT_MAX_LEN 36
#define INPUT_REP_KEYS_REF_ID 1
#define INPUT_IOS_KEYS_REF_ID 2
#define OUTPUT_REP_KEYS_REF_ID 0 // 1 is useless as well
static void hid_init(void)
{
int err;
struct bt_hids_init_param hids_init_obj = { 0 };
struct bt_hids_inp_rep *hids_inp_rep;
struct bt_hids_outp_feat_rep *hids_outp_rep;
//struct bt_hids_outp_feat_rep *hids_feature_rep;
static const uint8_t report_map[] = {
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
0x85, 0x01, // Report Id (1)
0x05, 0x07, // Usage Page (Keyboard)
0x19, 0xE0, // Usage Minimum (Keyboard Left Control)
0x29, 0xE7, // Usage Maximum (Keyboard 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,Value,Absolute,Bit Field)
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x01, // Input (Constant,Array,Absolute,Bit Field)
0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)2
0x05, 0x08, // Usage Page (LEDs)
0x19, 0x01, // Usage Minimum
0x29, 0x05, // Usage Maximum
0x91, 0x02, // Output (Data,Value,Absolute,Non-volatile,Bit Field)
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x91, 0x01, // Output (Constant,Array,Absolute,Non-volatile,Bit Field)
0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical minimum (0)
0x25, 0x65, // Logical maximum (101)
0x05, 0x07, // Usage Page (Keyboard)
0x19, 0x00, // Usage Minimum (No event indicated)
0x29, 0x65, // Usage Maximum (Keyboard Application)
0x81, 0x00, // Input (Data,Array,Absolute,Bit Field)
0xC0, // End Collection (Application)
0x05, 0x0C, // Usage Page (Consumer)
0x09, 0x01, // Usage (Consumer Control)
0xA1, 0x01, // Collection (Application)
0x85, 0x02, // Report ID (1)
0x05, 0x0C, // Usage Page (Consumer)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x08, // Report Size (1)
0x95, 0x01, // Report Count (8)
0x0A, 0xAE, 0x01, // Usage ( Keyboard Layout)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred)
0xC0 // End Collection
};
hids_init_obj.rep_map.data = report_map;
hids_init_obj.rep_map.size = sizeof(report_map);
hids_init_obj.info.bcd_hid = BASE_USB_HID_SPEC_VERSION;
hids_init_obj.info.b_country_code = 0x00;
hids_init_obj.info.flags = (BT_HIDS_REMOTE_WAKE |
BT_HIDS_NORMALLY_CONNECTABLE);
hids_inp_rep = &hids_init_obj.inp_rep_group_init.reports[INPUT_REP_KEYS_IDX];
hids_inp_rep->size = INPUT_REPORT_KEYS_MAX_LEN;
hids_inp_rep->id = INPUT_REP_KEYS_REF_ID;
hids_init_obj.inp_rep_group_init.cnt++;
hids_inp_rep = &hids_init_obj.inp_rep_group_init.reports[INPUT_REP_IOS_IDX];
hids_inp_rep->size = INPUT_REPORT_IOS_KEY_LEN;
hids_inp_rep->id = INPUT_IOS_KEYS_REF_ID;
hids_init_obj.inp_rep_group_init.cnt++;
hids_outp_rep = &hids_init_obj.outp_rep_group_init.reports[OUTPUT_REP_KEYS_IDX];
hids_outp_rep->size = OUTPUT_REPORT_MAX_LEN;
hids_outp_rep->id = OUTPUT_REP_KEYS_REF_ID;
hids_init_obj.boot_kb_outp_rep_handler = central_boot_write_cb;
hids_init_obj.outp_rep_group_init.cnt++;
hids_init_obj.is_kb = true;
err = bt_hids_init(&hids_obj, &hids_init_obj);
__ASSERT(err == 0, "HIDS initialization failed\n");
}