Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177740189
D58196.1795172320.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D58196.1795172320.diff
View Options
diff --git a/usr.sbin/usbdump/usbdump.8 b/usr.sbin/usbdump/usbdump.8
--- a/usr.sbin/usbdump/usbdump.8
+++ b/usr.sbin/usbdump/usbdump.8
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 14, 2021
+.Dd July 12, 2026
.Dt USBDUMP 8
.Os
.Sh NAME
@@ -37,6 +37,7 @@
.Op Fl i Ar ifname
.Op Fl r Ar file
.Op Fl s Ar snaplen
+.Op Fl t
.Op Fl u
.Op Fl v
.Op Fl w Ar file
@@ -90,6 +91,8 @@
Snapshot
.Ar snaplen
bytes from each packet.
+.It Fl t
+Do not print packet timestamps.
.It Fl u
Unbuffered output.
.It Fl v
@@ -140,7 +143,9 @@
The meaning of the output format elements is as follows:
.Bl -tag -width "<xfertype>"
.It <time>
-A timestamp preceding all output lines.
+A timestamp preceding all output lines, unless the
+.Fl t
+option is used.
The timestamp has the format "hh:mm:ss.frac" and is as accurate as
the kernel's clock.
.It <bus>
diff --git a/usr.sbin/usbdump/usbdump.c b/usr.sbin/usbdump/usbdump.c
--- a/usr.sbin/usbdump/usbdump.c
+++ b/usr.sbin/usbdump/usbdump.c
@@ -45,6 +45,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -108,6 +109,7 @@
static int doexit;
static int pkt_captured;
+static bool print_time = true;
static int verbose;
static int uf_minor;
static char *i_arg;
@@ -459,13 +461,9 @@
static void
print_apacket(const struct header_32 *hdr, const uint8_t *ptr, int ptr_len)
{
- struct tm *tm;
struct usbpf_pkthdr up_temp;
struct usbpf_pkthdr *up;
- struct timeval tv;
- size_t len;
uint32_t x;
- char buf[64];
ptr += USBPF_HDR_LEN;
ptr_len -= USBPF_HDR_LEN;
@@ -494,15 +492,22 @@
if (!match_filter(up->up_address, up->up_endpoint))
return;
- tv.tv_sec = hdr->ts_sec;
- tv.tv_usec = hdr->ts_usec;
- tm = localtime(&tv.tv_sec);
-
- len = strftime(buf, sizeof(buf), "%H:%M:%S", tm);
-
if (verbose >= 0) {
- printf("%.*s.%06ld usbus%d.%d %s-%s-EP=%08x,SPD=%s,NFR=%d,SLEN=%d,IVAL=%d%s%s\n",
- (int)len, buf, tv.tv_usec,
+ if (print_time) {
+ struct timeval tv;
+ char buf[64];
+ struct tm *tm;
+ size_t len;
+
+ tv.tv_sec = hdr->ts_sec;
+ tv.tv_usec = hdr->ts_usec;
+ tm = localtime(&tv.tv_sec);
+
+ len = strftime(buf, sizeof(buf), "%H:%M:%S", tm);
+ printf("%.*s.%06ld ", (int)len, buf, tv.tv_usec);
+ }
+
+ printf("usbus%d.%d %s-%s-EP=%08x,SPD=%s,NFR=%d,SLEN=%d,IVAL=%d%s%s\n",
(int)up->up_busunit, (int)up->up_address,
(up->up_type == USBPF_XFERTAP_SUBMIT) ? "SUBM" : "DONE",
usb_xferstr(up->up_xfertype),
@@ -784,6 +789,7 @@
fprintf(stderr, FMT, "-f <unit[.endpoint]>", "Specify a device and endpoint filter");
fprintf(stderr, FMT, "-r <file>", "Read the raw packets from file");
fprintf(stderr, FMT, "-s <snaplen>", "Snapshot bytes from each packet");
+ fprintf(stderr, FMT, "-t", "Do not print packet timestamps");
fprintf(stderr, FMT, "-v", "Increase the verbose level");
fprintf(stderr, FMT, "-b <file>", "Save raw version of all recorded data to file");
fprintf(stderr, FMT, "-w <file>", "Write the raw packets to file");
@@ -811,7 +817,7 @@
const char *optstring;
char *pp;
- optstring = "b:d:hi:r:s:uvw:f:";
+ optstring = "b:d:hi:r:s:tuvw:f:";
while ((o = getopt(argc, argv, optstring)) != -1) {
switch (o) {
case 'b':
@@ -881,6 +887,9 @@
if (snapshot == 0)
snapshot = -1;
break;
+ case 't':
+ print_time = false;
+ break;
case 'u':
setbuf(stdout, NULL);
setbuf(stderr, NULL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 20, 10:58 AM (8 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41866205
Default Alt Text
D58196.1795172320.diff (3 KB)
Attached To
Mode
D58196: usbdump: add -t to omit timestamps
Attached
Detach File
Event Timeline