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