Permalink
Browse files

Merge pull request #7 from veltzer/master

Patch reworked
  • Loading branch information...
2 parents ab90124 + b40b26d commit 179e2a7e85a31e221315ab60dd2b2f4a3be80a64 @gregkh committed Apr 10, 2012
Showing with 22 additions and 8 deletions.
  1. +8 −2 README
  2. +14 −6 lsusb.c
View
10 README
@@ -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
View
20 lsusb.c
@@ -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;
@@ -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"
@@ -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) {

0 comments on commit 179e2a7

Please sign in to comment.