fix(hid): Fix OUTPUT report not received (#10398)

Fixes an issue where the keyboard LEDs will not trigger the proper event
This commit is contained in:
Me No Dev 2024-10-02 15:34:27 +03:00 committed by GitHub
parent cd971319cb
commit 2ec5584d06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -453,7 +453,15 @@ __attribute__((weak)) int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cm
__attribute__((weak)) bool tud_msc_is_writable_cb(uint8_t lun) {
return false;
}
#endif
#if CFG_TUD_NCM
__attribute__((weak)) bool tud_network_recv_cb(const uint8_t *src, uint16_t size) {
return false;
}
__attribute__((weak)) uint16_t tud_network_xmit_cb(uint8_t *dst, void *ref, uint16_t arg) {
return 0;
}
__attribute__((weak)) void tud_network_init_cb(void) {}
#endif
/*

View file

@ -259,7 +259,7 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
// Invoked when received SET_REPORT control request or
// received data on OUT endpoint ( Report ID = 0, Type = 0 )
void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const *buffer, uint16_t bufsize) {
if (!report_id && !report_type) {
if (!report_id && (!report_type || report_type == HID_REPORT_TYPE_OUTPUT)) {
if (!tinyusb_on_set_output(0, buffer, bufsize) && !tinyusb_on_set_output(buffer[0], buffer + 1, bufsize - 1)) {
log_d(
"instance: %u, report_id: %u, report_type: %s, bufsize: %u", instance, buffer[0], tinyusb_hid_device_report_types[HID_REPORT_TYPE_OUTPUT], bufsize - 1