Skip to content

Commit

Permalink
[HID] Assume report ID 1 if none provided by descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Aug 9, 2022
1 parent 8bd6dae commit 3ff7b44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main/adapter/hid_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 3ff7b44

Please sign in to comment.