NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
USB Debug Techniques
This page outlines the common techniques to debug USB. Each section includes a link to the details.
Contents
sysfs[edit]
The sysfs entry for enumerated USB devices is /sys/bus/usb/devices/.
root@am335x-evm:~# ls /sys/bus/usb/devices/ 1-0:1.0 1-1 1-1:1.0 2-0:1.0 usb1 usb2
Each entry includes all the information about its USB device. The names that begins with usb refer to the USB controllers.
x-0:1.0 is a special case, which refers to the root hub's interface. The devices are named as
- bus-port.port.port
The interfaces follow in the form of
- :config.interface
Details:
debugfs[edit]
/sys/kernel/debug/usb/ |-- devices `-- usbmon
- devices: List of the devices enumerated on the bus with topology information.
- Details:
- <kernel source>/Documentation/us/proc_usb_info.txt
- usbmon: to capture USB traces on the BUS.
- Details:
- <kernel source>/Documentation/us/usbmon.txt
/sys/kernel/debug/<controller>/ |-- regdump |-- testmode |-- mode*: host, device, or otg `-- link_state*: speed
- *: only available in DWC3, not in MUSB.
Dymanic Debug Interface[edit]
Runtime turning on/off the kernel debug statements of dev_dbg() or dev_vdbg(). This interface is not limited to USB, it can be used to debug any driver which is ported to dev_dbg() framework.
Details:
- <kernel source>/Documentation/dynamic-debug-howto.txt
Ftrace[edit]
Ftrace is part of kernel tracing infrastructure which has zero overhead when disabled and minimal overhead when enabled. It is a very useful tool to debug USB issues.
Details:
- <kernel source>/Documentation/trace/ftrace.txt
Tracepints[edit]
Another tool in kernel tracing infrastructure for kernel debugging and performance diagnosis.
Details:
- <kernel source>/Documentation/trace/tracepoints.txt
USB protocol analyzer[edit]
A USB protocol analyzer is a USB bus sniffer which captures, decodes, filters and display USB bus activities.
Gadget Zero[edit]
Gadget Zero is a simple USB gadget driver that is useful for testing controller drivers. It implements two configurations, one for source/sink, the other for loopback. As of in 3.12 kernel, gadget Zero supports Control, Bulk and Isochronous transfers. The kernel community is working on implementing Interrupt transfer support.
Details: