aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usbdump.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usbdump.c b/usbdump.c
index a825c65..6558663 100644
--- a/usbdump.c
+++ b/usbdump.c
@@ -40,6 +40,7 @@
#define LINEBUF_LEN 16383
int opt_unique_num = 0;
+int opt_control_only = 0;
int64_t start_ts = 0;
int32_t start_ts_us = 0;
@@ -211,6 +212,9 @@ void usb_sniff(int bus, int address)
if (hdr->busnum != bus || hdr->devnum != address)
/* some other device */
continue;
+ if (opt_control_only && hdr->xfer_type != XFER_TYPE_CONTROL)
+ /* not a control transfer */
+ continue;
process_packet(hdr, &mbuf[vec[i]]+sizeof(struct usbmon_packet));
}
@@ -297,7 +301,7 @@ void usage(void)
{
printf("usbdump Copyright (C) 2011 Bert Vermeulen <bert@biot.com>\n");
- printf("usage: usbdump -d <vid:pid> [-u <num lines>]\n");
+ printf("usage: usbdump -d <vid:pid> [-u <num lines>] [-c]\n");
}
@@ -307,7 +311,7 @@ int main(int argc, char **argv)
char *device, *entry;
device = NULL;
- while ((opt = getopt(argc, argv, "d:u:")) != -1) {
+ while ((opt = getopt(argc, argv, "d:u:c")) != -1) {
switch (opt) {
case 'd':
if (strlen(optarg) != 9 || strspn(optarg, "01234567890abcdef:") != 9)
@@ -318,6 +322,9 @@ int main(int argc, char **argv)
case 'u':
opt_unique_num = strtol(optarg, NULL, 10);
break;
+ case 'c':
+ opt_control_only = 1;
+ break;
}
}