Showing posts with label gadget. Show all posts
Showing posts with label gadget. Show all posts

Tuesday, June 28, 2016

Linux USB Gadget Application Testing

Developing a USB gadget application that runs on Linux?
Following a recent Ceph USB gateway project, I was looking at ways to test a Linux USB device without the need to fiddle with cables, or deal with slow embedded board boot times.

Ideally USB gadget testing could be performed by running the USB device code within a virtual machine, and attaching the VM's virtual USB device port to an emulated USB host controller on the hypervisor system.


I was unfortunately unable to find support for virtual USB device ports in QEMU, so I abandoned the above architecture, and discovered dummy_hcd.ko instead.


The dummy_hcd Linux kernel module is an excellent utility for USB device testing from within a standalone system or VM.



dummy_hcd.ko offers the following features:
  • Re-route USB device traffic back to the local system
    • Effectively providing device loopback functionality
  • USB high-speed and super-speed connection simulation
It can be enabled via the USB_DUMMY_HCD kernel config parameter. Once the module is loaded, no further configuration is required.