git: 313f267bb0df - stable/13 - usbconfig: documentation fixes, mainly for -i option

From: Joerg Wunsch <joerg_at_FreeBSD.org>
Date: Tue, 18 Jan 2022 21:13:39 UTC
The branch stable/13 has been updated by joerg:

URL: https://cgit.FreeBSD.org/src/commit/?id=313f267bb0df789d28eb29f7eff15e217b114f84

commit 313f267bb0df789d28eb29f7eff15e217b114f84
Author:     Joerg Wunsch <joerg@FreeBSD.org>
AuthorDate: 2021-12-20 09:17:57 +0000
Commit:     Joerg Wunsch <joerg@FreeBSD.org>
CommitDate: 2022-01-18 21:12:35 +0000

    usbconfig: documentation fixes, mainly for -i option
    
    * in usage(), clearly mark -i interface as optional
    * both, -u busnum and -a devaddr are optional as well
    * various minor man page fixes
    * clearly mark those two commands that actually use -i ifaceidx
    * remove unused bitfield tag got_iface
    * fix indentation level according to review comment
    
    Differential Revision:  https://reviews.freebsd.org/D33579/
    Reviewed by:    hselasky
    MFC after:      2 weeks
    
    (cherry picked from commit cae1884d4791726f5acf5d64bba9a3583b63e38b)
---
 usr.sbin/usbconfig/usbconfig.8 | 14 +++++++++++---
 usr.sbin/usbconfig/usbconfig.c |  8 +++-----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/usr.sbin/usbconfig/usbconfig.8 b/usr.sbin/usbconfig/usbconfig.8
index ecfd0246eaac..dd6264451cf7 100644
--- a/usr.sbin/usbconfig/usbconfig.8
+++ b/usr.sbin/usbconfig/usbconfig.8
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 27, 2019
+.Dd December 20, 2021
 .Dt USBCONFIG 8
 .Os
 .Sh NAME
@@ -33,9 +33,11 @@
 .Nm
 .Op Fl u Ar unit
 .Op Fl a Ar addr
+.Op Fl i Ar interface_index
 .Op cmds...
 .Nm
-.Op Oo Fl d Oc Ar [ugen]<unit>.<addr>
+.Fl d Ar [[/dev/]ugen]<unit>.<addr>
+.Op Fl i Ar interface_index
 .Op cmds...
 .Sh DESCRIPTION
 The
@@ -49,7 +51,7 @@ Limit device range to USB devices connected to the given USBUS unit.
 .It Fl a Ar addr
 Limit device range to the given USB device index.
 Should only be used in conjunction with the unit argument.
-.It Fl d Ar [ugen]<unit>.<addr>
+.It Fl d Ar [[/dev/]ugen]<unit>.<addr>
 Limit device range to USB devices connected to the given unit and address.
 The unit and address coordinates may be prefixed by the lowercased word "ugen",
 or the full path name
@@ -83,6 +85,9 @@ in
 .Cm dump_curr_config_desc
 output.
 Usually there is no need to adjust this setting.
+This command uses the
+.Fl i Ar interface_index
+option.
 .It Cm set_template Ar template
 Set the global USB device side template.
 See
@@ -128,6 +133,9 @@ or
 currently attached to the device.
 .It Cm detach_kernel_driver
 Detach kernel driver for the selected interface and USB device.
+This command uses the
+.Fl i Ar interface_index
+option.
 .It Cm suspend
 Force the device to suspend.
 .It Cm resume
diff --git a/usr.sbin/usbconfig/usbconfig.c b/usr.sbin/usbconfig/usbconfig.c
index a19ff8039186..986aa6cd8f7b 100644
--- a/usr.sbin/usbconfig/usbconfig.c
+++ b/usr.sbin/usbconfig/usbconfig.c
@@ -65,7 +65,6 @@ struct options {
 	uint8_t	got_list:1;
 	uint8_t	got_bus:1;
 	uint8_t	got_addr:1;
-	uint8_t	got_iface:1;
 	uint8_t	got_set_config:1;
 	uint8_t	got_set_alt:1;
 	uint8_t	got_set_template:1;
@@ -272,8 +271,8 @@ usage(void)
 {
 	fprintf(stderr, ""
 	    "usbconfig - configure the USB subsystem" "\n"
-	    "usage: usbconfig -u <busnum> -a <devaddr> -i <ifaceindex> [cmds...]" "\n"
-	    "usage: usbconfig -d [ugen]<busnum>.<devaddr> -i <ifaceindex> [cmds...]" "\n"
+	    "usage: usbconfig [-u <busnum>] [-a <devaddr>] [-i <ifaceindex>] [cmds...]" "\n"
+	    "usage: usbconfig -d [ugen]<busnum>.<devaddr> [-i <ifaceindex>] [cmds...]" "\n"
 	    "commands:" "\n"
 	    "  set_config <cfg_index>" "\n"
 	    "  set_alt <alt_index>" "\n"
@@ -576,7 +575,7 @@ main(int argc, char **argv)
 			if (strncmp(optarg, "ugen", strlen("ugen")) == 0) {
 				ptr = optarg + strlen("ugen");
 			} else if (strncmp(optarg, "/dev/ugen",
-					 strlen("/dev/ugen")) == 0) {
+			   strlen("/dev/ugen")) == 0) {
 				ptr = optarg + strlen("/dev/ugen");
 			} else {
 				ptr = optarg;
@@ -596,7 +595,6 @@ main(int argc, char **argv)
 
 		case 'i':
 			opt->iface = num_id(optarg, "iface");
-			opt->got_iface = 1;
 			break;
 
 		case 'u':