USBDUMP(8) BSD System Manager's Manual USBDUMP(8)NAME
usbdump -- dump traffic on USB host controller
usbdump [-i ifname] [-r file] [-s snaplen] [-v] [-w file] [-f filter] [-b file] [-h]
The usbdump utility provides a way to dump USB packets on host controllers.
The following options are accepted:
-b file Store data part of the USB trace in binary format to the given file. This option also works with the -r and -f options.
Listen on USB bus interface ifname.
-r file Read the raw packets from file. This option also works with the -f option.
Snapshot snaplen bytes from each packet.
-v Enable debugging messages. When defined multiple times the verbosity level increases.
-w file Write the raw packets to file. This option also works with the -s and -v options.
The filter argument consists of either one or two numbers separated by a dot. The first indicates the device unit number which
should be traced. The second number which is optional indicates the endpoint which should be traced. To get all traffic for the
control endpoint, two filters should be created, one for endpoint 0 and one for endpoint 128. If 128 is added to the endpoint num-
ber that means IN direction, else OUT direction is implied. A device unit or endpoint value of -1 means ignore this field. If no
filters are specified, all packets are passed through using the default -1,-1 filter. This option can be specified multiple times.
-h This option displays a summary of the command line options.
Capture the USB raw packets on usbus2:
usbdump -i usbus2 -s 256 -v
Dump the USB raw packets of usbus2 into the file without packet size limit:
usbdump -i usbus2 -s 0 -w /tmp/dump_pkts
Dump the USB raw packets of usbus2, but only the control endpoint traffic of device unit number 3:
usbdump -i usbus2 -s 0 -f 3.0 -f 3.128 -w /tmp/dump_pkts
Read and display the USB raw packets from previous file:
usbdump -r /tmp/dump_pkts -v
The output format of usbdump is as follows:
<time> <bus>.<addr> <ep> <xfertype> <S/D> (<frames>/<length>) <...>
The meaning of the output format elements is as follows:
<time> A timestamp preceding all output lines. The timestamp has the format "hh:mm:ss.frac" and is as accurate as the kernel's clock.
<bus> The USB host controller's bus unit number.
<addr> The unique number of the USB device as allocated by the host controller driver.
<ep> The USB endpoint address that indicates whether the address is OUT or IN.
<xfertype> The USB transfer type. Can be CTRL, ISOC, BULK or INTR.
<S/D> `S' indicates a USB submit. `D' indicates a USB transfer done.
<frames> Numbers of frames in this packets. If this is a USB submit, its value is xfer->nframes which means how many frames are accept-
able or registered to transfer. If this is a USB done, xfer->aframes is the actual number of frames.
<length> Total packet size. If this is a USB submit, its value is xfer->sumlen. If this is a USB done, its value is xfer->actlen.
<...> Optional field used for printing an error string if the packet is from USB done.
SEE ALSO usbconfig(8)AUTHORS
Weongyo Jeong <weongyo@FreeBSD.org>
BSD April 24, 2012 BSD
Check Out this Related Man Page
USB(4) BSD Kernel Interfaces Manual USB(4)NAME
usb -- Universal Serial Bus
To compile this driver into the kernel, place the following line in your kernel configuration file:
Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):
USB functions can be accessed from userland through the libusb library. See libusb(3) for more information.
FreeBSD provides machine-independent bus support and drivers for USB devices in host and device side mode.
The usb driver has three layers:
USB Controller (Bus)
The controller attaches to a physical bus like pci(4). The USB bus attaches to the controller, and the root hub attaches to the controller.
Any devices attached to the bus will attach to the root hub or another hub attached to the USB bus.
The uhub device will always be present as it is needed for the root hub.
INTRODUCTION TO USB
The USB is a system where external devices can be connected to a PC. The most common USB speeds are:
Low Speed (1.5MBit/sec)
Full Speed (12MBit/sec)
High Speed (480MBit/sec)
Each USB has a USB controller that is the master of the bus. The physical communication is simplex which means the host controller only com-
municates with one USB device at a time.
There can be up to 127 devices connected to an USB HUB tree. The addresses are assigned dynamically by the host when each device is attached
to the bus.
Within each device there can be up to 16 endpoints. Each endpoint is individually addressed and the addresses are static. Each of these
endpoints will communicate in one of four different modes: control, isochronous, bulk, or interrupt. A device always has at least one end-
point. This endpoint has address 0 and is a control endpoint and is used to give commands to and extract basic data, such as descriptors,
from the device. Each endpoint, except the control endpoint, is unidirectional.
The endpoints in a device are grouped into interfaces. An interface is a logical unit within a device; e.g. a compound device with both a
keyboard and a trackball would present one interface for each. An interface can sometimes be set into different modes, called alternate set-
tings, which affects how it operates. Different alternate settings can have different endpoints within it.
A device may operate in different configurations. Depending on the configuration, the device may present different sets of endpoints and
The bus enumeration of the USB bus proceeds in several steps:
1. Any interface specific driver can attach to the device.
2. If none is found, generic interface class drivers can attach.
The USB specifications can be found at:
libusb(3), usbdi(4), aue(4), axe(4), cue(4), ehci(4), kue(4), ohci(4), pci(4), rue(4), ucom(4), udav(4), uhci(4), uhid(4), ukbd(4), ulpt(4),
umass(4), ums(4), uplcom(4), urio(4), uvscom(4), usbconfig(8)STANDARDS
The usb module complies with the USB 2.0 standard.
The usb module has been inspired by the NetBSD USB stack initially written by Lennart Augustsson. The usb module was written by Hans Petter
BSD May 20, 2009 BSD