Files
tinyusb/examples/host/device_info
hathach fa1fee0a5f migrate NXP Kinetis khci to chipidea ci_fs driver (device + host)
Complete the khci -> chipidea ci_fs migration that was started for device
(commit d70403f1f "host is not yet"):

- device: switch kinetis_k/kl/k32l (Makefiles + k32l CMake) to dcd_ci_fs.c
- host: add hcd_ci_fs.c (port of hcd_khci.c onto ci_fs_regs_t) and switch all
  Kinetis families to it; remove src/portable/nxp/khci entirely
- enable host examples (device_info, cdc_msc_hid) for mcu:KINETIS_K
- README: merge the KL and K32L2 rows into a single "KL, K32L" ci_fs row

hcd_ci_fs.c also fixes two pre-existing host bugs found via HIL on frdm_k64f
(present in the old hcd_khci.c too):
- data toggle was flipped on a NAK in suspend_transfer; a NAK transfers no
  data so the toggle must be preserved, else the retried bulk packet is
  silently discarded by the device (MSC CBW/CSW hang). See comment in file.
- prepare_packets asserted and dropped a transfer when the single shared BDT
  was still owned by an in-flight transfer under concurrent activity; now it
  returns busy and resume_transfer defers/retries on the next SOF.

HIL verified on frdm_k64f: device 13/13, host cdc_msc_hid (CDC mount + echo +
MSC mount, through a hub).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExGPLP5eU43LR7o6yYLpNi
2026-07-17 17:26:02 +07:00
..
2025-02-09 00:25:38 +01:00
2025-10-14 17:53:55 +07:00
2026-03-06 17:19:05 +01:00

Host: Device Info

A USB host example that enumerates any attached device and prints its descriptor information over the debug UART. No class drivers are enabled — only the hub driver, so it works with any kind of device.

What it does

  • On mount of any device, fetches and prints the full device descriptor: VID/PID, USB version, device class/subclass/protocol, max packet size, bcdDevice, and number of configurations.
  • Reads and prints the manufacturer, product, and serial-number string descriptors (UTF-16 to UTF-8), falling back to a placeholder serial when none is present.
  • Blinks the board LED, with a faster pattern while no device is mounted.
  • Builds on either the bare main loop or a FreeRTOS task, depending on CFG_TUSB_OS.

Requirements

The board must support USB host mode (provide VBUS to the connected device); some boards need an external USB-A port / host adapter.

Configuration

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

Building

CMake:

mkdir build && cd build
cmake -DBOARD=raspberry_pi_pico ..
cmake --build .

Make:

make BOARD=raspberry_pi_pico all

How to use

Plug any USB device into the board's USB host port. The debug UART prints the device's ID vvvv:pppp, serial number, and the decoded device descriptor (a hub lets you attach several devices, each printed in turn). Unplugging the device prints a removal message.