I would like to (A) run something under windows to eavesdrop on the communication between a USB device and windows, so I can then (B) write something to communicate with the USB device, under Linux. Can anybody recommend a program to do (A)?
usbsnoopy is working well for me - my only gripe with this version is that it doesn't show live data (you need to stop the capture to see the data) and that you need to reconnect the device after stopping the capture to get a new capture started (at least, that's the only thing that worked for me).
Pat
2010-05-06 22:40:16
+1
A:
Your best bet for watching USB traffic on Windows is Snoopy Pro which is based on USB Snoopy.
Once you move over to implementing your driver for Linux, you will want to make sure that usbmon is enabled in your kernel so you can get at the same information on your Linux box.
Make sure your kernel includes the necessary components:
$ cat /boot/config-`uname -r` | grep -P "CONFIG_USB_(MON|DEVICEFS)
CONFIG_USB_DEVICEFS=y
CONFIG_USB_MON=y
Mount the usbmon file system and make sure there is stuff in the usbmon directory:
$ sudo mount -t debugfs none_debugs /sys/kernel/debug
$ ls /sys/kernel/debug/usbmon/
0s 0u 1s 1t 1u 2s 2t 2u 3s 3t 3u 4s 4t 4u 5s 5t 5u 6s 6t 6u
Use lsusb to find the bus number of the device you are interested in:
$ lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 045e:00d1 Microsoft Corp. Optical Mouse with Tilt Wheel
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Start listening on the bus of your choice (I am listening on bus 4 below):
$ sudo cat /sys/kernel/debug/usbmon/4u > ~/Desktop/usbmon.txt
Stop collecting data with Control-C.
Tim Kryger
2009-10-18 07:42:53