Skip to content

Commit

Permalink
hid: don't increment usage_count (in local items) on skipped reports
Browse files Browse the repository at this point in the history
  • Loading branch information
gyurco committed Oct 11, 2024
1 parent 0e30724 commit 90dcaf0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions usb/hidparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ bool parse_report_descriptor(uint8_t *rep, uint16_t rep_size, hid_report_t *conf
if (conf->report_id) {
if(report_is_usable(bit_count, report_complete, conf)) {
skip_report = (conf->report_id == value) ? 0 : 1;
if (skip_report) hidp_extreme_debugf(" -> skip report %d", value);
break;
}
else if (skip_report) {
Expand Down Expand Up @@ -462,17 +463,17 @@ bool parse_report_descriptor(uint8_t *rep, uint16_t rep_size, hid_report_t *conf
// return false;
}

usage_count++;
if (!skip_report) usage_count++;
break;

case 1:
hidp_extreme_debugf("USAGE_MINIMUM(%d)", value);
usage_count -= (value-1);
if (!skip_report) usage_count -= (value-1);
break;

case 2:
hidp_extreme_debugf("USAGE_MAXIMUM(%d)", value);
usage_count += value;
if (!skip_report) usage_count += value;
break;

default:
Expand Down

0 comments on commit 90dcaf0

Please sign in to comment.