summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2012-01-12 14:31:59 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-12 14:31:59 -0800
commita492ca466b290ecb6bdfaa0891abcb51e5905481 (patch)
tree1c94239c128a2faac5492e44ac57dbba95ba5d21
parent623f0f24c7d62c749ff18649e18a32f8d57c421c (diff)
downloadusbutils-a492ca466b290ecb6bdfaa0891abcb51e5905481.tar.gz
make treedump() work if the database isn't there.
treedump() doesn't require neither names nor libusb so it's a shame to abort in case we failed to parse usb.ids or to initialize libusb... Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--lsusb.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lsusb.c b/lsusb.c
index 03ca978..2e9c211 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -4004,6 +4004,12 @@ int main(int argc, char *argv[])
exit(1);
}
+ if (treemode) {
+ /* treemode requires at least verblevel 1 */
+ verblevel += 1 - VERBLEVEL_DEFAULT;
+ return treedump();
+ }
+
/* by default, print names as well as numbers */
err = names_init(DATADIR "/usb.ids");
#ifdef HAVE_LIBZ
@@ -4023,11 +4029,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
- if (treemode) {
- /* treemode requires at least verblevel 1 */
- verblevel += 1 - VERBLEVEL_DEFAULT;
- status = treedump();
- } else if (devdump)
+ if (devdump)
status = dump_one_device(ctx, devdump);
else
status = list_devices(ctx, bus, devnum, vendor, product);