Skip to content

Commit

Permalink
Merge pull request #7 from veltzer/master
Browse files Browse the repository at this point in the history
Patch reworked
  • Loading branch information
gregkh committed Apr 10, 2012
2 parents ab90124 + b40b26d commit 179e2a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
10 changes: 8 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
first get usbhid-dump:
git submodule init
git submodule update
initialize autobuild with:
autoreconf --install --symlink
./configure
autoreconf --install --symlink
configure with:
./configure
build with:
make
20 changes: 14 additions & 6 deletions lsusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3917,26 +3917,32 @@ int main(int argc, char *argv[])
static const struct option long_options[] = {
{ "version", 0, 0, 'V' },
{ "verbose", 0, 0, 'v' },
{ "help", 0, 0, 'h' },
{ "tree", 0, 0, 't' },
{ 0, 0, 0, 0 }
};
libusb_context *ctx;
int c, err = 0;
unsigned int allowctrlmsg = 0, treemode = 0;
int bus = -1, devnum = -1, vendor = -1, product = -1;
const char *devdump = NULL;
int help = 0;
char *cp;
int status;

while ((c = getopt_long(argc, argv, "D:vxtP:p:s:d:V",
while ((c = getopt_long(argc, argv, "D:vxtP:p:s:d:V:h",
long_options, NULL)) != EOF) {
switch (c) {
case 'V':
printf("lsusb (" PACKAGE ") " VERSION "\n");
exit(0);

return EXIT_SUCCESS;
case 'v':
verblevel++;
break;

case 'h':
help=1;
break;

case 'x':
allowctrlmsg = 1;
Expand Down Expand Up @@ -3983,7 +3989,7 @@ int main(int argc, char *argv[])
break;
}
}
if (err || argc > optind) {
if (err || argc > optind || help) {
fprintf(stderr, "Usage: lsusb [options]...\n"
"List USB devices\n"
" -v, --verbose\n"
Expand All @@ -3996,12 +4002,14 @@ int main(int argc, char *argv[])
" product ID numbers (in hexadecimal)\n"
" -D device\n"
" Selects which device lsusb will examine\n"
" -t\n"
" -t, --tree\n"
" Dump the physical USB device hierarchy as a tree\n"
" -V, --version\n"
" Show version of program\n"
" -h, --help\n"
" Show usage and help\n"
);
exit(1);
return EXIT_FAILURE;
}

if (treemode) {
Expand Down

0 comments on commit 179e2a7

Please sign in to comment.