Skip to content

Windows Debugging

Nathanael Schneider edited this page Jun 15, 2023 · 5 revisions

To debug USB devices under windows, use Wireshark with the PCap-Driver. If you need lower-level logging, use the windows internal tool (which is hard to parse though) by running those commands in an elevated terminal to create a trace configuration:

logman create trace -n usbtrace -o <PATH TO LOGFILE> -nb 128 640 -bs 128
logman update trace -n usbtrace -p Microsoft-Windows-USB-USBXHCI "(Default,PartialDataBusTrace,StateMachine)"
logman update trace -n usbtrace -p Microsoft-Windows-USB-USBXHCI "(Default,PartialDataBusTrace)"
logman update trace -n usbtrace -p Microsoft-Windows-USB-UCX "(Default,PartialDataBusTrace)"
logman update trace -n usbtrace -p Microsoft-Windows-USB-USBHUB3 "(Default,PartialDataBusTrace)"
logman update trace -n usbtrace -p Microsoft-Windows-USB-USBPORT
logman update trace -n usbtrace -p Microsoft-Windows-USB-USBHUB
logman update trace -n usbtrace -p Microsoft-Windows-Kernel-IoTrace 0 2

To start the trace, use logman start -n usbtrace and to stop it use logman stop -n usbtrace. Afterwards, open your resulting file with PerfView. You'll find the relevant data under the Event-View.

To delete the trace configuration once you're done, use logman delete -n usbtrace

To debug the USB device descriptor, you can use the Thesycon USB Descriptor Dumper

Clone this wiki locally