Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
    
You mean for network packages or for any generic USB device plugged in to your system? –  Bruno Pereira Oct 27 '11 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. –  YumYumYum Oct 27 '11 at 9:34
add comment

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
I think he is asking something for a generic USB device, not a specific network one. –  Bruno Pereira Oct 27 '11 at 9:22
    
@jeremy Kerr: you mean the latest screen shot way? But can you do PCI-E debug? –  YumYumYum Oct 27 '11 at 9:38
    
Is there any command line way? (without GUI). –  YumYumYum Oct 27 '11 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. –  Jeremy Kerr Oct 28 '11 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. –  Jeremy Kerr Oct 28 '11 at 1:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.