xref: /freebsd/usr.sbin/usbconfig/usbconfig.8 (revision 2f9966ff63d65bd474478888c9088eeae3f9c669)
1.\"
2.\" Copyright (c) 2008-2019 Hans Petter Selasky. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd January 29, 2022
26.Dt USBCONFIG 8
27.Os
28.Sh NAME
29.Nm usbconfig
30.Nd configure the USB subsystem
31.Sh SYNOPSIS
32.Nm
33.Op Fl v
34.Op Fl a Ar addr
35.Op Fl i Ar interface_index
36.Op Fl u Ar unit
37.Op Ar cmds ...
38.Nm
39.Fl d
40.Sm off
41.Oo Oo Cm /dev/ Oc Cm ugen Oc Ar unit Cm \&. Ar addr
42.Sm on
43.Op Fl v
44.Op Fl i Ar interface_index
45.Op Ar cmds ...
46.Sh DESCRIPTION
47The
48.Nm
49utility is used to configure and dump information about the USB subsystem.
50.Pp
51The options are as follows:
52.Bl -tag -width "-u unit"
53.It Fl a Ar addr
54Limit device range to the given USB device index.
55Should only be used in conjunction with the unit argument.
56.It Xo
57.Fl d
58.Sm off
59.Oo Oo Cm /dev/ Oc Cm ugen Oc Ar unit Cm \&. Ar addr
60.Sm on
61.Xc
62Limit device range to USB devices connected to the given unit and address.
63The unit and address coordinates may be prefixed by the lowercased word
64.Cm ugen ,
65or the full path name
66.Cm /dev/ugen .
67.It Fl h
68Show help and available commands.
69.It Fl i Ar interface_index
70Specify interface index as indicated by the command description.
71If this argument is not specified
72a value of zero will be used for the interface index.
73.It Fl u Ar unit
74Limit device range to USB devices connected to the given USBUS unit.
75.It Fl v
76Activate the
77.Cm dump_device_desc ,
78.Cm dump_curr_config_desc ,
79and
80.Cm show_ifdrv
81commands
82.Pq Dq verbose mode .
83.El
84.Pp
85The following commands may be used with
86.Nm :
87.Bl -tag -width indent
88.It Cm set_config Ar cfg_index
89Choose the configuration for the USB device.
90Valid values range from zero to the number reported as the
91.Ar bNumConfigurations
92in
93.Cm dump_device_desc
94output.
95The special value of 255 unconfigures the device, detaching
96the interface drivers and reducing the power consumption to minimum,
97but without going into power saving mode or detaching from the bus.
98In some cases, it prevents the device from charging.
99.It Cm set_alt Ar alt_index
100Choose the alternate interface for the selected interface and USB device.
101Alternative settings for the current configuration are available as the
102.Ar bAlternateSetting
103in
104.Cm dump_curr_config_desc
105output.
106Usually there is no need to adjust this setting.
107This command uses the
108.Fl i Ar interface_index
109option.
110.It Cm set_template Ar template
111Set the global USB device side template.
112See
113.Xr usb_template 4
114for more information.
115.It Cm get_template
116Get the current USB device side template.
117.It Cm add_dev_quirk_vplh Ar vid Ar pid Ar lo_rev Ar hi_rev Ar quirk_name
118Add a quirk by specifying the Vendor ID, Product ID, low and high
119revision numbers, and the quirk name.
120See
121.Xr usb_quirk 4
122for more information.
123.It Cm remove_dev_quirk_vplh Ar vid Ar pid Ar lo_rev Ar hi_rev Ar quirk_name
124Remove a quirk.
125.It Cm add_quirk Ar quirk_name
126Add quirk for the currently selected USB device.
127.It Cm remove_quirk Ar quirk_name
128Remove a quirk for the currently selected USB device.
129.It Cm dump_all_desc
130Display the device and configuration descriptors.
131.It Cm dump_quirk_names
132Display the list of supported quirk names.
133.It Cm dump_device_quirks
134Display the list of current device quirks.
135.It Cm dump_device_desc
136Display the device descriptor.
137.It Cm dump_curr_config_desc
138Display current configuration descriptor.
139.It Cm dump_all_config_desc
140Display all the configuration descriptors.
141.It Cm dump_string Ar index
142Display string descriptor at selected index.
143.It Cm dump_info
144Display summary information about the device.
145.It Cm dump_stats
146Display USB transfer statistics.
147.It Cm show_ifdrv
148Display the list of interface drivers (such as
149.Xr ukbd 4
150or
151.Xr u3g 4 )
152currently attached to the device.
153.It Cm detach_kernel_driver
154Detach kernel driver for the selected interface and USB device.
155This command uses the
156.Fl i Ar interface_index
157option.
158.It Cm suspend
159Force the device to suspend.
160.It Cm resume
161Force the device to resume.
162.It Cm power_off
163Turn the device off.
164.It Cm power_save
165Turn the automatic suspend and resume on.
166This is the default for USB hubs.
167.It Cm power_on
168Turn the device on and disable automatic suspend and resume.
169This is the default for non-hub devices.
170.It Cm reset
171Reset the device.
172This forces the USB stack to reenumerate the bus.
173.It Cm list
174List all available USB devices.
175This is the default if
176.Nm
177is called without specifying a command.
178.It Cm do_request Ar bmReqTyp Ar bReq Ar wVal Ar wIdx Ar wLen Ar data...
179Perform a synchronous control request on the specified device.
180See
181.Xr libusb20_dev_request_sync 3
182for more information.
183.El
184.Sh EXAMPLES
185List all connected USB devices and their attached interface drivers:
186.Pp
187.Dl usbconfig show_ifdrv
188.Pp
189Dump device and configuration descriptors for device on USB bus 1 at address 2:
190.Pp
191.Dl usbconfig -d ugen1.2 dump_all_desc
192.Pp
193Dump HID descriptor for device on USB bus 1 at address 2:
194.Pp
195.Dl usbconfig -d ugen1.2 do_request 0x81 0x06 0x2200 0 0x100
196.Pp
197Power off the device on USB bus 1 at address 2:
198.Pp
199.Dl usbconfig -d ugen1.2 power_off
200.Sh SEE ALSO
201.Xr usb 4 ,
202.Xr usb_quirk 4 ,
203.Xr usb_template 4
204