1e64ac239SWeongyo Jeong.\" 2e64ac239SWeongyo Jeong.\" Copyright (c) 2010 Weongyo Jeong. 3e64ac239SWeongyo Jeong.\" All rights reserved. 4e64ac239SWeongyo Jeong.\" 5e64ac239SWeongyo Jeong.\" Redistribution and use in source and binary forms, with or without 6e64ac239SWeongyo Jeong.\" modification, are permitted provided that the following conditions 7e64ac239SWeongyo Jeong.\" are met: 8e64ac239SWeongyo Jeong.\" 1. Redistributions of source code must retain the above copyright 9e64ac239SWeongyo Jeong.\" notice, this list of conditions and the following disclaimer. 10e64ac239SWeongyo Jeong.\" 2. Redistributions in binary form must reproduce the above copyright 11e64ac239SWeongyo Jeong.\" notice, this list of conditions and the following disclaimer in the 12e64ac239SWeongyo Jeong.\" documentation and/or other materials provided with the distribution. 13e64ac239SWeongyo Jeong.\" 14e64ac239SWeongyo Jeong.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15e64ac239SWeongyo Jeong.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16e64ac239SWeongyo Jeong.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17e64ac239SWeongyo Jeong.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18e64ac239SWeongyo Jeong.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19e64ac239SWeongyo Jeong.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20e64ac239SWeongyo Jeong.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21e64ac239SWeongyo Jeong.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22e64ac239SWeongyo Jeong.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23e64ac239SWeongyo Jeong.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24e64ac239SWeongyo Jeong.\" SUCH DAMAGE. 25e64ac239SWeongyo Jeong.\" 26e64ac239SWeongyo Jeong.\" $FreeBSD$ 27e64ac239SWeongyo Jeong.\" 28*6b436e62SBenedict Reuschling.Dd May 31, 2011 29a6d11f71SRuslan Ermilov.Dt USBDUMP 8 30e64ac239SWeongyo Jeong.Os 31e64ac239SWeongyo Jeong.Sh NAME 32e64ac239SWeongyo Jeong.Nm usbdump 33e64ac239SWeongyo Jeong.Nd "dump traffic on USB host controller" 34e64ac239SWeongyo Jeong.Sh SYNOPSIS 35e64ac239SWeongyo Jeong.Nm 36e64ac239SWeongyo Jeong.Op Fl i Ar ifname 37e64ac239SWeongyo Jeong.Op Fl r Ar file 38e64ac239SWeongyo Jeong.Op Fl s Ar snaplen 39e64ac239SWeongyo Jeong.Op Fl v 40e64ac239SWeongyo Jeong.Op Fl w Ar file 41e64ac239SWeongyo Jeong.Sh DESCRIPTION 42e64ac239SWeongyo JeongThe 43e64ac239SWeongyo Jeong.Nm 4458ea8701SWeongyo Jeongutility provides a way to dump USB packets on host controllers. 45e64ac239SWeongyo Jeong.Pp 4658ea8701SWeongyo JeongThe following options are accepted: 47e64ac239SWeongyo Jeong.Bl -tag -width ".Fl f Ar file" 48e64ac239SWeongyo Jeong.It Fl i Ar ifname 4958ea8701SWeongyo JeongListen on USB bus interface 5058ea8701SWeongyo Jeong.Ar ifname . 51e64ac239SWeongyo Jeong.It Fl r Ar file 5258ea8701SWeongyo JeongRead the raw packets from 5358ea8701SWeongyo Jeong.Ar file . 54e64ac239SWeongyo Jeong.It Fl s Ar snaplen 5558ea8701SWeongyo JeongSnapshot 5658ea8701SWeongyo Jeong.Ar snaplen 5758ea8701SWeongyo Jeongbytes from each packet. 58e64ac239SWeongyo Jeong.It Fl v 59e64ac239SWeongyo JeongEnable debugging messages. 6058ea8701SWeongyo JeongWhen defined multiple times the verbosity level increases. 61e64ac239SWeongyo Jeong.It Fl w Ar file 6258ea8701SWeongyo JeongWrite the raw packets to 6358ea8701SWeongyo Jeong.Ar file . 64e64ac239SWeongyo Jeong.El 65e64ac239SWeongyo Jeong.Sh EXAMPLES 66*6b436e62SBenedict ReuschlingCapture the USB raw packets on usbus2: 67e64ac239SWeongyo Jeong.Pp 68e64ac239SWeongyo Jeong.Dl "usbdump -i usbus2 -s 256 -v" 69e64ac239SWeongyo Jeong.Pp 70*6b436e62SBenedict ReuschlingDump the USB raw packets of usbus2 into the file without packet 71e64ac239SWeongyo Jeongsize limit: 72e64ac239SWeongyo Jeong.Pp 73e64ac239SWeongyo Jeong.Dl "usbdump -i usbus2 -s 0 -w /tmp/dump_pkts" 74e64ac239SWeongyo Jeong.Pp 75*6b436e62SBenedict ReuschlingRead and display the USB raw packets from previous file: 76e64ac239SWeongyo Jeong.Pp 77e64ac239SWeongyo Jeong.Dl "usbdump -r /tmp/dump_pkts -v" 7858ea8701SWeongyo Jeong.Sh OUTPUT FORMAT 7958ea8701SWeongyo JeongThe output format of 8058ea8701SWeongyo Jeong.Nm 8158ea8701SWeongyo Jeongis as follows: 8258ea8701SWeongyo Jeong.Pp 8358ea8701SWeongyo Jeong.Dl "<time> <bus>.<addr> <ep> <xfertype> <S/D> (<frames>/<length>) <...>" 8458ea8701SWeongyo Jeong.Pp 8558ea8701SWeongyo JeongThe meaning of the output format elements is as follows: 8658ea8701SWeongyo Jeong.Bl -tag -width "<xfertype>" 8758ea8701SWeongyo Jeong.It <time> 8858ea8701SWeongyo JeongA timestamp preceding all output lines. 8958ea8701SWeongyo JeongThe timestamp has the format "hh:mm:ss.frac" and is as accurate as 9058ea8701SWeongyo Jeongthe kernel's clock. 9158ea8701SWeongyo Jeong.It <bus> 9258ea8701SWeongyo JeongThe USB host controller's bus unit number. 9358ea8701SWeongyo Jeong.It <addr> 9458ea8701SWeongyo JeongThe unique number of the USB device as allocated by the host controller driver. 9558ea8701SWeongyo Jeong.It <ep> 9658ea8701SWeongyo JeongThe USB endpoint address that indicates whether the address is 9758ea8701SWeongyo Jeong.Dv OUT 9858ea8701SWeongyo Jeongor 9958ea8701SWeongyo Jeong.Dv IN . 10058ea8701SWeongyo Jeong.It <xfertype> 10158ea8701SWeongyo JeongThe USB transfer type. 10258ea8701SWeongyo JeongCan be 10358ea8701SWeongyo Jeong.Dv CTRL , 10458ea8701SWeongyo Jeong.Dv ISOC , 10558ea8701SWeongyo Jeong.Dv BULK 10658ea8701SWeongyo Jeongor 10758ea8701SWeongyo Jeong.Dv INTR . 10858ea8701SWeongyo Jeong.It <S/D> 10958ea8701SWeongyo Jeong`S' indicates a USB submit. 11058ea8701SWeongyo Jeong`D' indicates a USB transfer done. 11158ea8701SWeongyo Jeong.It <frames> 11258ea8701SWeongyo JeongNumbers of frames in this packets. 11358ea8701SWeongyo JeongIf this is a USB submit, its value is 11458ea8701SWeongyo Jeong.Li xfer->nframes 11558ea8701SWeongyo Jeongwhich means how many frames are acceptable or registered to transfer. 11658ea8701SWeongyo JeongIf this is a USB done, 11758ea8701SWeongyo Jeong.Li xfer->aframes 11858ea8701SWeongyo Jeongis the actual number of frames. 11958ea8701SWeongyo Jeong.It <length> 12058ea8701SWeongyo JeongTotal packet size. 12158ea8701SWeongyo JeongIf this is a USB submit, its value is 12258ea8701SWeongyo Jeong.Li xfer->sumlen . 12358ea8701SWeongyo JeongIf this is a USB done, its value is 12458ea8701SWeongyo Jeong.Li xfer->actlen . 12558ea8701SWeongyo Jeong.It <...> 12658ea8701SWeongyo JeongOptional field used for printing an error string if the packet is from USB done. 12758ea8701SWeongyo Jeong.El 128e64ac239SWeongyo Jeong.Sh SEE ALSO 129e64ac239SWeongyo Jeong.Xr usbconfig 8 130e64ac239SWeongyo Jeong.Sh AUTHORS 131e64ac239SWeongyo Jeong.An Weongyo Jeong 13258ea8701SWeongyo Jeong.Aq weongyo@FreeBSD.org 133