hid_device: move id and report size check from hid_report_data_callback to library

This commit is contained in:
Milanka Ringwald 2018-10-09 22:25:33 +02:00
parent dbcaefc7b3
commit 738c9391f8
2 changed files with 6 additions and 6 deletions

View File

@ -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_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]);
break;
default:

View File

@ -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){
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");
}