A USB host example that drives the TinyUSB host stack through its low-level API directly, without the higher-level class-driver application layer.
tuh_edpt_open / tuh_edpt_xfer) and continuously prints the incoming HID reports as raw hex bytes.The board must support USB host mode (provide VBUS to the connected device); some boards need an external USB-A port / host adapter.
Notable tusb_config.h settings:
#define CFG_TUH_ENABLED 1 #define CFG_TUH_HUB 1 #define CFG_TUH_DEVICE_MAX (3*CFG_TUH_HUB + 1) #define CFG_TUH_ENUMERATION_BUFSIZE 256 #define CFG_TUH_API_EDPT_XFER 1
CMake:
mkdir build && cd build cmake -DBOARD=raspberry_pi_pico .. cmake --build .
Make:
make BOARD=raspberry_pi_pico all
Plug any USB device (a HID keyboard/mouse works well) into the board's USB host port. On attach you should see Device attached followed by the full device/string/configuration descriptor dump on the debug UART. If the device exposes a HID interface, its interrupt-IN reports are printed as hex as they arrive (e.g. when you press a key or move the mouse).