summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2012-04-10 16:39:35 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2012-04-10 16:39:35 -0700
commit179e2a7e85a31e221315ab60dd2b2f4a3be80a64 (patch)
treee9e291cfd2cf5468b1021970cc735ec238375fbe
parentab90124da44a908c11822f975a6e3f76d7b994a9 (diff)
parentb40b26d95a57b5f826647bccc8bb0a83105e99cd (diff)
downloadusbutils-179e2a7e85a31e221315ab60dd2b2f4a3be80a64.tar.gz
Merge pull request #7 from veltzer/master
Patch reworked
-rw-r--r--README10
-rw-r--r--lsusb.c20
2 files changed, 22 insertions, 8 deletions
diff --git a/README b/README
index 39ce782..5a97c05 100644
--- a/README
+++ b/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
diff --git a/lsusb.c b/lsusb.c
index 2e9c211..08813f0 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -3917,6 +3917,8 @@ 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;
@@ -3924,19 +3926,23 @@ int main(int argc, char *argv[])
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) {