mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-28 16:11:24 +00:00
btstack_hid_parser: ignore report items without usage
This commit is contained in:
parent
cd7411deb4
commit
dfb01e7774
@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- AVRCP: shorten default SDP Service and Provider Names
|
||||
- GATT Client: emit query complete event for gatt_client_discover_characteristic_descriptors in next run loop iteration
|
||||
- HFP: report 1.9 in SDP record
|
||||
- HID Parser: ignore Report Items without Usage
|
||||
- btstack_crypto: allow MBEDTLS config via MBEDTLS_CONFIG_FILE
|
||||
- remove old Zephyr 1.9 port
|
||||
|
||||
|
@ -202,11 +202,9 @@ static void btstack_hid_handle_global_item(btstack_hid_parser_t * parser, hid_de
|
||||
break;
|
||||
case ReportID:
|
||||
if (parser->active_record && (parser->global_report_id != item->item_value)){
|
||||
// log_debug("New report, don't match anymore");
|
||||
parser->active_record = 0;
|
||||
}
|
||||
parser->global_report_id = item->item_value;
|
||||
// log_info("- Report ID: %02x", parser->global_report_id);
|
||||
break;
|
||||
case ReportCount:
|
||||
parser->global_report_count = item->item_value;
|
||||
@ -255,6 +253,9 @@ static void hid_find_next_usage(btstack_hid_parser_t * parser){
|
||||
}
|
||||
if (parser->have_usage_min && parser->have_usage_max){
|
||||
parser->available_usages = parser->usage_maximum - parser->usage_minimum + 1u;
|
||||
if (parser->available_usages < parser->required_usages){
|
||||
log_debug("Usage Min - Usage Max [%04x..%04x] < Report Count %u", parser->usage_minimum, parser->usage_maximum, parser->required_usages);
|
||||
}
|
||||
parser->have_usage_min = 0;
|
||||
parser->have_usage_max = 0;
|
||||
}
|
||||
@ -340,7 +341,7 @@ static void btstack_hid_parser_find_next_usage(btstack_hid_parser_t * parser){
|
||||
if (parser->available_usages) {
|
||||
parser->state = BTSTACK_HID_PARSER_USAGES_AVAILABLE;
|
||||
} else {
|
||||
log_error("no usages found");
|
||||
log_debug("no usages found");
|
||||
parser->state = BTSTACK_HID_PARSER_COMPLETE;
|
||||
}
|
||||
} else {
|
||||
@ -404,6 +405,12 @@ void btstack_hid_parser_get_field(btstack_hid_parser_t * parser, uint16_t * usag
|
||||
if (is_variable){
|
||||
parser->usage_minimum++;
|
||||
parser->available_usages--;
|
||||
if (parser->usage_minimum > parser->usage_maximum){
|
||||
// usage min - max range smaller than report count, ignore remaining bit in report
|
||||
log_debug("Ignoring %u items without Usage", parser->required_usages);
|
||||
parser->report_pos_in_bit += parser->global_report_size * parser->required_usages;
|
||||
parser->required_usages = 0;
|
||||
}
|
||||
} else {
|
||||
if (parser->required_usages == 0u){
|
||||
parser->available_usages = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user