Skip to content

Commit 2ec5584

Browse files
authored
fix(hid): Fix OUTPUT report not received (espressif#10398)
Fixes an issue where the keyboard LEDs will not trigger the proper event
1 parent cd97131 commit 2ec5584

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cores/esp32/esp32-hal-tinyusb.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,15 @@ __attribute__((weak)) int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cm
453453
__attribute__((weak)) bool tud_msc_is_writable_cb(uint8_t lun) {
454454
return false;
455455
}
456-
456+
#endif
457+
#if CFG_TUD_NCM
458+
__attribute__((weak)) bool tud_network_recv_cb(const uint8_t *src, uint16_t size) {
459+
return false;
460+
}
461+
__attribute__((weak)) uint16_t tud_network_xmit_cb(uint8_t *dst, void *ref, uint16_t arg) {
462+
return 0;
463+
}
464+
__attribute__((weak)) void tud_network_init_cb(void) {}
457465
#endif
458466

459467
/*

libraries/USB/src/USBHID.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
259259
// Invoked when received SET_REPORT control request or
260260
// received data on OUT endpoint ( Report ID = 0, Type = 0 )
261261
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) {
262-
if (!report_id && !report_type) {
262+
if (!report_id && (!report_type || report_type == HID_REPORT_TYPE_OUTPUT)) {
263263
if (!tinyusb_on_set_output(0, buffer, bufsize) && !tinyusb_on_set_output(buffer[0], buffer + 1, bufsize - 1)) {
264264
log_d(
265265
"instance: %u, report_id: %u, report_type: %s, bufsize: %u", instance, buffer[0], tinyusb_hid_device_report_types[HID_REPORT_TYPE_OUTPUT], bufsize - 1

0 commit comments

Comments
 (0)