From 3ff7b448c43726f0e24d874cb0ee5869ff7c8cb5 Mon Sep 17 00:00:00 2001 From: Jacques Gagnon Date: Mon, 8 Aug 2022 20:51:08 -0400 Subject: [PATCH] [HID] Assume report ID 1 if none provided by descriptor --- main/adapter/hid_parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/adapter/hid_parser.c b/main/adapter/hid_parser.c index 4f3e8510..f40c0a96 100644 --- a/main/adapter/hid_parser.c +++ b/main/adapter/hid_parser.c @@ -272,6 +272,7 @@ void hid_parser(struct bt_data *bt_data, uint8_t *data, uint32_t len) { uint8_t *end = data + len; uint8_t *desc = data; uint8_t report_id = 0; + uint8_t report_cnt = 0; uint32_t report_bit_offset = 0; uint32_t report_usage_idx = 0; @@ -407,6 +408,7 @@ void hid_parser(struct bt_data *bt_data, uint8_t *data, uint32_t len) { /* process previous report fingerprint */ if (report_id) { hid_process_report(bt_data, &wip_report, report_bit_offset, report_usage_idx); + report_cnt++; } memset((void *)&wip_report, 0, sizeof(wip_report)); report_id = *desc++; @@ -461,6 +463,9 @@ void hid_parser(struct bt_data *bt_data, uint8_t *data, uint32_t len) { return; } } + if (report_cnt == 0) { + report_id = 1; + } if (report_id) { hid_process_report(bt_data, &wip_report, report_bit_offset, report_usage_idx); }