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