3

How to debug and trace USB device connected to my system. So that i can build my own driver, where manufacturer never wants to build it for Linux platform.

For example with network equipment i can crack and build something using a debug and packet tracing e.g: tcpdump -i any -x

10:04:07.597910 IP localhost.localdomain.afs3-bos > localhost.localdomain.55400: Flags [.], ack 383, win 529, options [nop,nop,TS val 5627394 ecr 5627394], length 0
    0x0000:  4500 0034 5c59 4000 4006 e068 7f00 0001
    0x0010:  7f00 0001 1b5f d868 56e8 837f 577b 5164
    0x0020:  8010 0211 fe28 0000 0101 080a 0055 de02
    0x0030:  0055 de02

How can i do this for USB2.0 or USB3.0 or PCI-X1 cards?

enter image description here

2
  • You mean for network packages or for any generic USB device plugged in to your system? Oct 27, 2011 at 9:23
  • @brunopereira81: yes you are right. any generic USB device. So that i can make a USB cable and connect it to my broken old mobile device. And check if i can send/receive data to my mobile using USB.
    – user25165
    Oct 27, 2011 at 9:34

1 Answer 1

3

The wireshark utility has a USB-capture mode (as well as network packet capture), and provides a nice GUI for the captured data.

Note that you'll need to run wireshark as root.

If you're after a non-GUI option, you can use the kernel's usbmon interface directly. See usbmon.txt in the kernel source tree for documentation

5
  • I think he is asking something for a generic USB device, not a specific network one. Oct 27, 2011 at 9:22
  • @jeremy Kerr: you mean the latest screen shot way? But can you do PCI-E debug?
    – user25165
    Oct 27, 2011 at 9:38
  • Is there any command line way? (without GUI).
    – user25165
    Oct 27, 2011 at 9:40
  • @brunopereira81: this is not specific to USB network devices; it can be configured to capture the raw USB data instead of network packets. Oct 28, 2011 at 1:44
  • @goOgle: updated to include usbmon info. PCI-E is harder - device drivers can access PCI memory space directly, so there's no easy way to hook a monitor into this. However, you may be able to use a system simulator (like qemu) to do what you want here. Oct 28, 2011 at 1:49

You must log in to answer this question.