Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2018 15:51:19 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332581 - stable/11/usr.sbin/usbconfig
Message-ID:  <201804161551.w3GFpJBT080100@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Apr 16 15:51:19 2018
New Revision: 332581
URL: https://svnweb.freebsd.org/changeset/base/332581

Log:
  MFC r330875:
  
  Add "usbconfig dump_all_desc", a subcommand to dump all device and config
  descriptors.

Modified:
  stable/11/usr.sbin/usbconfig/usbconfig.8
  stable/11/usr.sbin/usbconfig/usbconfig.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/usbconfig/usbconfig.8
==============================================================================
--- stable/11/usr.sbin/usbconfig/usbconfig.8	Mon Apr 16 15:50:10 2018	(r332580)
+++ stable/11/usr.sbin/usbconfig/usbconfig.8	Mon Apr 16 15:51:19 2018	(r332581)
@@ -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: stable/11/usr.sbin/usbconfig/usbconfig.c
==============================================================================
--- stable/11/usr.sbin/usbconfig/usbconfig.c	Mon Apr 16 15:50:10 2018	(r332580)
+++ stable/11/usr.sbin/usbconfig/usbconfig.c	Mon Apr 16 15:51:19 2018	(r332581)
@@ -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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804161551.w3GFpJBT080100>