svn commit: r330875 - head/usr.sbin/usbconfig
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Mar 13 19:49:07 UTC 2018
Author: trasz
Date: Tue Mar 13 19:49:06 2018
New Revision: 330875
URL: https://svnweb.freebsd.org/changeset/base/330875
Log:
Add "usbconfig dump_all_desc", a subcommand to dump all device and config
descriptors.
Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Modified:
head/usr.sbin/usbconfig/usbconfig.8
head/usr.sbin/usbconfig/usbconfig.c
Modified: head/usr.sbin/usbconfig/usbconfig.8
==============================================================================
--- head/usr.sbin/usbconfig/usbconfig.8 Tue Mar 13 19:28:03 2018 (r330874)
+++ head/usr.sbin/usbconfig/usbconfig.8 Tue Mar 13 19:49:06 2018 (r330875)
@@ -97,6 +97,8 @@ Remove a quirk.
Add quirk for the currently selected USB device.
.It Cm remove_quirk Ar quirk_name
Remove a quirk for the currently selected USB device.
+.It Cm dump_all_desc
+Display the device and configuration descriptors.
.It Cm dump_quirk_names
Display the list of supported quirk names.
.It Cm dump_device_quirks
Modified: head/usr.sbin/usbconfig/usbconfig.c
==============================================================================
--- head/usr.sbin/usbconfig/usbconfig.c Tue Mar 13 19:28:03 2018 (r330874)
+++ head/usr.sbin/usbconfig/usbconfig.c Tue Mar 13 19:49:06 2018 (r330875)
@@ -77,6 +77,7 @@ struct options {
uint8_t got_power_on:1;
uint8_t got_dump_device_quirks:1;
uint8_t got_dump_quirk_names:1;
+ uint8_t got_dump_all_desc:1;
uint8_t got_dump_device_desc:1;
uint8_t got_dump_curr_config:1;
uint8_t got_dump_all_config:1;
@@ -112,6 +113,7 @@ enum {
T_SHOW_IFACE_DRIVER,
T_DUMP_QUIRK_NAMES,
T_DUMP_DEVICE_QUIRKS,
+ T_DUMP_ALL_DESC,
T_DUMP_DEVICE_DESC,
T_DUMP_CURR_CONFIG_DESC,
T_DUMP_ALL_CONFIG_DESC,
@@ -144,6 +146,7 @@ static const struct token token[] = {
{"remove_quirk", T_REMOVE_QUIRK, 1},
{"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0},
{"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0},
+ {"dump_all_desc", T_DUMP_ALL_DESC, 0},
{"dump_device_desc", T_DUMP_DEVICE_DESC, 0},
{"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0},
{"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0},
@@ -283,6 +286,7 @@ usage(void)
" remove_quirk <quirk>" "\n"
" dump_quirk_names" "\n"
" dump_device_quirks" "\n"
+ " dump_all_desc" "\n"
" dump_device_desc" "\n"
" dump_curr_config_desc" "\n"
" dump_all_config_desc" "\n"
@@ -489,7 +493,8 @@ flush_command(struct libusb20_backend *pbe, struct opt
}
}
dump_any =
- (opt->got_dump_device_desc ||
+ (opt->got_dump_all_desc ||
+ opt->got_dump_device_desc ||
opt->got_dump_curr_config ||
opt->got_dump_all_config ||
opt->got_dump_info);
@@ -508,6 +513,10 @@ flush_command(struct libusb20_backend *pbe, struct opt
} else if (opt->got_dump_curr_config) {
printf("\n");
dump_config(pdev, 0);
+ } else if (opt->got_dump_all_desc) {
+ printf("\n");
+ dump_device_desc(pdev);
+ dump_config(pdev, 1);
}
if (dump_any) {
printf("\n");
@@ -694,6 +703,12 @@ main(int argc, char **argv)
if (opt->got_get_template)
duplicate_option(argv[n]);
opt->got_get_template = 1;
+ opt->got_any++;
+ break;
+ case T_DUMP_ALL_DESC:
+ if (opt->got_dump_all_desc)
+ duplicate_option(argv[n]);
+ opt->got_dump_all_desc = 1;
opt->got_any++;
break;
case T_DUMP_DEVICE_DESC:
More information about the svn-src-head
mailing list