Open delan opened 1 year ago
Having the same issue here with native USB host on RP2040. tuh_mount_cb()
works as in the example, but the HID callbacks don't work because it seems to always link the weak definitions from Adafruit_USBH_Host.cpp
instead of being overridden by my own strong definitions.
For the record I have confirmed that this is what is happening by using breakpoints on Picoprobe debugger. I have also confirmed that commenting out the weak definitions fixes the problem.
I don't know what it is about these particular weak definitions that is confusing the linker, but I do wonder is there even any reason to have them duplicated in Adafruit_USBH_Host.cpp
when they already exist in hid_host.h
?
Thanks @JonnyHaystack! 3.1.0 is still affected, and I can confirm removing those definitions fixes the problem for me.
@hathach, it looks like the addition of TU_ATTR_WEAK in hid_host.h in hathach/tinyusb#1968 was the breaking change, so if we can’t remove those empty definitions in Adafruit_USBH_Host.cpp for some reason, then we need to remove TU_ATTR_WEAK from the tuh_hid_mount_cb declaration (and tuh_hid_umount_cb and tuh_hid_report_received_cb).
(This probably explains why tuh_hid_umount_cb has never worked for me…)
Can confirm this with 3.1.5
+ PlatformIO + rp2020 earlephilhower core; removal of TU_ATTR_WEAK
from tuh_hid_mount_cb
and tuh_hid_umount_cb
definitions in hid_host.h
, i can see hid callbacks being raised. Workarounds appreciated.
Operating System
Windows 10
Arduino IDE version
PlatformIO 6.1.6
Board
pico
ArduinoCore version
earlephilhower/arduino-pico@3.1.1
TinyUSB Library version
2.0.2+
Sketch as ATTACHED TXT
delan/usb3sun@04ba656717d7a04db0a5b68266c1fe9469e5f6f5
Compiled Log as ATTACHED TXT
n/a
What happened ?
When upgrading the library from 2.0.1 to 2.0.2, tuh_mount_cb is called, but tuh_hid_mount_cb and tuh_hid_report_received_cb are no longer called.
How to reproduce ?
git apply
repro.patchpio run -t upload
)Debug Log
Screenshots
No response