Linux USB debugging

Source: Internet
Author: User
Tags dmesg
Linuxusb driver debugging: This is the linuxusb driver debugging-003: A detailed page for preparation under Ubuntu. It introduces the knowledge, skills, and experience related to Linux, and some Linux source code. Preparations in Ubuntu: (1) how to view the printk output in the kernel: dmesg
Combined with the pipeline command, dmesg | head, dmesg | tail can see the content output by printk in the pipeline. This is a useful tool. (2) USB packet capture tool: usb_mon, in fact, Ubuntu has a built-in USB packet capture tool --- usb_mon [In fact, make menuconfig will let us choose] The usage method is as follows: # Mount-T debugfs NONE/sys/kernel/debug
# Modprobe usbmon
View the current USB device:
# Cat/sys/kernel/debug/USB/devices

The following output:
T: Bus = 01 lev= 01 prnt = 01 port = 00 CNT = 01 Dev # = 12 SPD = 480 mxch = 0
D: ver = 2.00 CLS = 00 (> IFC) sub = 00 prot = 00 mxps = 64 # cfgs = 1
P: Vendor = 601a ProdID = 4740 Rev = 1.00
S: Manufacturer = Ingenic
S: Product = JZ4740 USB Boot Device
C: * # Ifs = 1 Cfg # = 1 xcode = c0 MxPwr = 2mA
I: * If # = 0 Alt = 0 # EPs = 2 Cls = ff (vend.) Sub = 00 Prot = 50 Driver = skeleton
E: Ad = 01 (O) 2.2.02( Bulk) MxPS = 512 Ivl = 0 ms
E: Ad = 81 (I) 2.2.02 (Bulk) MxPS = 512 Ivl = 0 ms

How can I understand the above output? Documentation/usb/usbmon.txt
Bus = 01 means it's bus 1.
We can find the Bus number of our device through the above Vendor = 601a ProdID. Above Bus = 01. Use the following fame and fortune to listen to all USB packets on Bus01.
# Cat/sys/kernel/debug/usb/usbmon/1u
To start listening to all USB packets on all buses:
# Cat/sys/kernel/debug/usb/usbmon/0u

Once a packet exists, it is printed:
# Cat/sys/kernel/debug/USB/usbmon/1u
F07dbb80 3233986312 s co: 1: 012: 0 s 40 01 80c0 0000 0000 0
F07dbb80 3234327703 c co: 1: 012: 0 0 0
F07dbb80 3234327880 s co: 1: 012: 0 s 40 02 0000 0200 0000 0
F07dbb80 3234329561 c co: 1: 012: 0 0 0
F07dbb80 3234329625 s bi: 1: 012: 1-115 32 <
F07dbb80 3234331550 C bi: 1: 012: 1-75 32 = 00000000 00000000... For more information, see the USB mon.txt urb tag.
Timestamp: milliseconds
Event Type: S-submission, C-callback, E-submission error.
URBType: BusNo: DeviceAddr: EndPointNum
Ci Co Control input and output
Zi Zo Isochronous input and output
Ii Io Interrupt input and output
Bi Bo Bulk input and output
URB Status: 0 indicates no error. -XXX is the error code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.