mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
hid_device: move id and report size check from hid_report_data_callback to library
This commit is contained in:
parent
dbcaefc7b3
commit
738c9391f8
@ -503,6 +503,12 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
|
|||||||
}
|
}
|
||||||
device->report_type = packet[0] & 0x03;
|
device->report_type = packet[0] & 0x03;
|
||||||
device->report_id = packet[1];
|
device->report_id = packet[1];
|
||||||
|
|
||||||
|
if (hid_report_id_status(device->cid, device->report_id) == HID_REPORT_ID_INVALID ||
|
||||||
|
!hid_report_size_valid(device->cid, device->report_id, device->report_type, packet_size - 2)){
|
||||||
|
log_info("Ignore report data packet\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
(*hci_device_report_data)(device->cid, device->report_type, device->report_id, packet_size - 2, &packet[2]);
|
(*hci_device_report_data)(device->cid, device->report_type, device->report_id, packet_size - 2, &packet[2]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -353,12 +353,6 @@ static hid_handshake_param_type_t hid_set_report_callback(uint16_t cid, hid_repo
|
|||||||
|
|
||||||
static void hid_report_data_callback(uint16_t cid, hid_report_type_t report_type, uint16_t report_id, int report_size, uint8_t * report){
|
static void hid_report_data_callback(uint16_t cid, hid_report_type_t report_type, uint16_t report_id, int report_size, uint8_t * report){
|
||||||
UNUSED(report);
|
UNUSED(report);
|
||||||
|
|
||||||
if ( hid_report_id_status(cid, report_id) == HID_REPORT_ID_INVALID ||
|
|
||||||
!hid_report_size_valid(cid, report_id, report_type, report_size)){
|
|
||||||
printf("ignore data packet\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
printf("do smth with report\n");
|
printf("do smth with report\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user