xref: /freebsd/usr.sbin/usbconfig/usbconfig.8 (revision c66308d7bcc3931b60a096bfe6ba0f50105e77de)
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 February 12, 2025
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 l
34.Op Fl v
35.Op Fl a Ar addr
36.Op Fl i Ar interface_index
37.Op Fl u Ar unit
38.Op Ar cmds ...
39.Nm
40.Fl d
41.Sm off
42.Oo Oo Cm /dev/ Oc Cm ugen Oc Ar unit Cm \&. Ar addr
43.Sm on
44.Op Fl l
45.Op Fl v
46.Op Fl i Ar interface_index
47.Op Ar cmds ...
48.Sh DESCRIPTION
49The
50.Nm
51utility is used to configure and dump information about the USB subsystem.
52.Pp
53The options are as follows:
54.Bl -tag -width "-u unit"
55.It Fl a Ar addr
56Limit device range to the given USB device index.
57Should only be used in conjunction with the unit argument.
58.It Xo
59.Fl d
60.Sm off
61.Oo Oo Cm /dev/ Oc Cm ugen Oc Ar unit Cm \&. Ar addr
62.Sm on
63.Xc
64Limit device range to USB devices connected to the given unit and address.
65The unit and address coordinates may be prefixed by the lowercased word
66.Cm ugen ,
67or the full path name
68.Cm /dev/ugen .
69.It Fl h
70Show help and available commands.
71.It Fl i Ar interface_index
72Specify interface index as indicated by the command description.
73If this argument is not specified
74a value of zero will be used for the interface index.
75.It Fl l Cm dump_device_desc
76Show numeral only key=value output as one long line.
77.It Fl u Ar unit
78Limit device range to USB devices connected to the given USBUS unit.
79.It Fl v
80Activate the
81.Cm dump_device_desc ,
82.Cm dump_curr_config_desc ,
83and
84.Cm show_ifdrv
85commands
86.Pq Dq verbose mode .
87.El
88.Pp
89The following commands may be used with
90.Nm :
91.Bl -tag -width indent
92.It Cm set_config Ar cfg_index
93Choose the configuration for the USB device.
94Valid values range from zero to the number reported as the
95.Ar bNumConfigurations
96in
97.Cm dump_device_desc
98output.
99The special value of 255 unconfigures the device, detaching
100the interface drivers and reducing the power consumption to minimum,
101but without going into power saving mode or detaching from the bus.
102In some cases, it prevents the device from charging.
103.It Cm set_alt Ar alt_index
104Choose the alternate interface for the selected interface and USB device.
105Alternative settings for the current configuration are available as the
106.Ar bAlternateSetting
107in
108.Cm dump_curr_config_desc
109output.
110Usually there is no need to adjust this setting.
111This command uses the
112.Fl i Ar interface_index
113option.
114.It Cm set_template Ar template
115Set the global USB device side template.
116See
117.Xr usb_template 4
118for more information.
119.It Cm get_template
120Get the current USB device side template.
121.It Cm add_dev_quirk_vplh Ar vid Ar pid Ar lo_rev Ar hi_rev Ar quirk_name
122Add a quirk by specifying the Vendor ID, Product ID, low and high
123revision numbers, and the quirk name.
124See
125.Xr usb_quirk 4
126for more information.
127.It Cm remove_dev_quirk_vplh Ar vid Ar pid Ar lo_rev Ar hi_rev Ar quirk_name
128Remove a quirk.
129.It Cm add_quirk Ar quirk_name
130Add quirk for the currently selected USB device.
131.It Cm remove_quirk Ar quirk_name
132Remove a quirk for the currently selected USB device.
133.It Cm dump_all_desc
134Display the device and configuration descriptors.
135.It Cm dump_quirk_names
136Display the list of supported quirk names.
137.It Cm dump_device_quirks
138Display the list of current device quirks.
139.It Cm dump_device_desc
140Display the device descriptor.
141.It Cm dump_curr_config_desc
142Display current configuration descriptor.
143.It Cm dump_all_config_desc
144Display all the configuration descriptors.
145.It Cm dump_string Ar index
146Display string descriptor at selected index.
147.It Cm dump_info
148Display summary information about the device.
149.It Cm dump_stats
150Display USB transfer statistics.
151.It Cm show_ifdrv
152Display the list of interface drivers (such as
153.Xr ukbd 4
154or
155.Xr u3g 4 )
156currently attached to the device.
157.It Cm detach_kernel_driver
158Detach kernel driver for the selected interface and USB device.
159This command uses the
160.Fl i Ar interface_index
161option.
162.It Cm suspend
163Force the device to suspend.
164.It Cm resume
165Force the device to resume.
166.It Cm power_off
167Turn the device off.
168.It Cm power_save
169Turn the automatic suspend and resume on.
170This is the default for USB hubs.
171.It Cm power_on
172Turn the device on and disable automatic suspend and resume.
173This is the default for non-hub devices.
174.It Cm reset
175Reset the device.
176This forces the USB stack to reenumerate the bus.
177.It Cm list
178List all available USB devices.
179This is the default if
180.Nm
181is called without specifying a command.
182.It Cm do_request Ar bmReqTyp Ar bReq Ar wVal Ar wIdx Ar wLen Ar data...
183Perform a synchronous control request on the specified device.
184See
185.Xr libusb20_dev_request_sync 3
186for more information.
187.El
188.Sh EXAMPLES
189List all connected USB devices and their attached interface drivers:
190.Pp
191.Dl usbconfig show_ifdrv
192.Pp
193Dump device and configuration descriptors for device on USB bus 1 at address 2:
194.Pp
195.Dl usbconfig -d ugen1.2 dump_all_desc
196.Pp
197Dump HID descriptor for device on USB bus 1 at address 2:
198.Pp
199.Dl usbconfig -d ugen1.2 do_request 0x81 0x06 0x2200 0 0x100
200.Pp
201Power off the device on USB bus 1 at address 2:
202.Pp
203.Dl usbconfig -d ugen1.2 power_off
204.Sh SEE ALSO
205.Xr usb 4 ,
206.Xr usb_quirk 4 ,
207.Xr usb_template 4
208