Apply Chapter 09’s enumeration steps to a USB Rocket Launcher toy. This lab observes descriptors, driver binding, and device events. Keep the toy unloaded throughout the experiment.
1. Observe USB enumeration
Watch the kernel log in Terminal A.
sudo dmesg -w
Plug in the device and run the following in Terminal B.
lsusb
lsusb -t
Record the new device’s ID and substitute the actual value for VID:PID.
sudo lsusb -v -d VID:PID
| Field or command | What to check |
|---|---|
idVendor / idProduct |
The USB device identity |
bInterfaceClass |
HID, vendor-specific, or another interface class |
| Endpoint descriptor | Direction and transfer type for each endpoint |
lsusb -t |
The driver bound to each interface |
2. Check for a corresponding hidraw node
If /dev/hidrawN appears, identify which device it belongs to.
for path in /sys/class/hidraw/hidraw*; do
[ -r "$path/device/uevent" ] || continue
printf '\n%s\n' "/dev/${path##*/}"
cat "$path/device/uevent"
done
Compare the vendor and product fields in HID_ID with the values from lsusb. The node number can change across reconnects, so use device identification information to locate it.
3. Observe hotplug events
udevadm monitor --kernel --udev --property
Unplug the device, reconnect it, and look for remove and add. As an extension, write a C program using libudev. Pass the monitor file descriptor to poll() and print only the hotplug events for the target VID:PID. The GPIO lab waits for readable data. This lab waits for device arrival and removal.
4. Verify the Yocto image
Include usbutils and the device monitoring tools used by the image. If the device enumerates as HID, verify USB HID and hidraw kernel support. Boot a new image and repeat enumeration, driver identification, and hotplug monitoring.