examples/dual/host_info_to_device_cdc/README.md
A dual-role bridge: the board acts as a USB host on one root-hub port and a USB device on another at the same time, printing information about any device plugged into the host port out to the PC over a virtual serial port.
(DEVICE-side interfaces only)
| Interface | Class driver |
|---|---|
| 0–1 | CDC (virtual serial) |
Notable tusb_config.h settings:
#define CFG_TUD_CDC 1
#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 256)
#define CFG_TUH_HUB 1
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1)
#define CFG_TUH_ENUMERATION_BUFSIZE 256
The board needs two usable USB ports: one acting as host (for the device to inspect) and one acting as device (to the PC).
CMake:
mkdir build && cd build
cmake -DBOARD=raspberry_pi_pico ..
cmake --build .
Make:
make BOARD=raspberry_pi_pico all
/dev/ttyACMx on Linux, a COM port on Windows).mounted device N line followed by a full device-descriptor dump (IDs, strings, and field values). Removing the device prints an unmounted device N line.