Annotation of src/usr.bin/usbhidctl/usbhidctl.1, Revision 1.16
1.16 ! naddy 1: .\" $OpenBSD: usbhidctl.1,v 1.15 2021/05/31 18:30:11 jcs Exp $
1.4 nate 2: .\" $NetBSD: usbhidctl.1,v 1.14 2001/12/28 17:49:32 augustss Exp $
1.1 pvalchev 3: .\"
1.4 nate 4: .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
1.1 pvalchev 5: .\" All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to The NetBSD Foundation
8: .\" by David Sainty <David.Sainty@dtsp.co.nz>
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
18: .\"
19: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29: .\" POSSIBILITY OF SUCH DAMAGE.
30: .\"
1.16 ! naddy 31: .Dd $Mdocdate: May 31 2021 $
1.1 pvalchev 32: .Dt USBHIDCTL 1
33: .Os
34: .Sh NAME
35: .Nm usbhidctl
36: .Nd manipulate USB HID devices
37: .Sh SYNOPSIS
1.2 jakob 38: .Nm
1.1 pvalchev 39: .Fl f Ar device
40: .Op Fl t Ar table
1.12 jakemsr 41: .Op Fl alv
1.2 jakob 42: .Nm
1.1 pvalchev 43: .Fl f Ar device
44: .Op Fl t Ar table
45: .Op Fl v
46: .Fl r
1.2 jakob 47: .Nm
1.1 pvalchev 48: .Fl f Ar device
49: .Op Fl t Ar table
1.8 jmc 50: .Op Fl lnv
1.9 jmc 51: .Ar name ...
1.2 jakob 52: .Nm
1.1 pvalchev 53: .Fl f Ar device
54: .Op Fl t Ar table
1.9 jmc 55: .Fl w Ar name Ns = Ns Ar value ...
1.15 jcs 56: .Nm
57: .Fl f Ar device
58: .Fl R
1.1 pvalchev 59: .Sh DESCRIPTION
60: .Nm
1.6 jmc 61: can be used to output or modify the state of a USB HID (Human Interface Device).
62: If a list of items is present on the command line, then
1.1 pvalchev 63: .Nm
1.6 jmc 64: prints the current value of those items for the specified device.
65: If the
1.1 pvalchev 66: .Fl w
1.16 ! naddy 67: flag is specified,
1.1 pvalchev 68: .Nm
69: attempts to set the specified items to the given values.
70: .Pp
71: The options are as follows:
72: .Bl -tag -width Ds
73: .It Fl a
74: Show all items and their current values.
1.4 nate 75: This option fails if the device does not support the GET_REPORT command.
1.12 jakemsr 76: This is the default, if no parameters other than
77: .Fl f
78: are given to
79: .Nm .
1.1 pvalchev 80: .It Fl f Ar device
1.6 jmc 81: Specify a path name for the device to operate on.
82: If
1.1 pvalchev 83: .Ar device
1.6 jmc 84: is numeric, it is taken to be the USB HID device number.
85: If it is a relative path, it is taken to be the name of the device under
1.1 pvalchev 86: .Pa /dev .
87: An absolute path is taken to be the literal device pathname.
88: .It Fl l
1.6 jmc 89: Loop and dump the device data every time it changes.
90: Only 'input' items are displayed in this mode.
1.1 pvalchev 91: .It Fl n
1.6 jmc 92: Suppress printing of the item name when querying specific items.
93: Only output the current value.
1.15 jcs 94: .It Fl R
95: Dump the raw USB HID report descriptor data as hexadecimal bytes.
1.1 pvalchev 96: .It Fl r
1.4 nate 97: Dump the USB HID report descriptor.
1.1 pvalchev 98: .It Fl t Ar table
99: Specify a path name for the HID usage table file.
100: .It Fl v
1.6 jmc 101: Be verbose.
102: Repeating this option increases verbosity.
1.1 pvalchev 103: .It Fl w
1.6 jmc 104: Change item values.
105: Only 'output' and 'feature' kinds can be set with this option.
1.1 pvalchev 106: .El
1.4 nate 107: .Sh SYNTAX
108: .Nm
109: parses the names of items specified on the command line against the human
1.6 jmc 110: interface items reported by the USB device.
111: Each human interface item is mapped from its native form to a human readable
112: name, using the HID usage table file.
113: Command line items are compared with the generated item names,
1.4 nate 114: and the USB HID device is operated on when a match is found.
115: .Pp
116: Each human interface item is named by the
117: .Qq page
118: it appears in, the
119: .Qq usage
120: within that page, and the list of
121: .Qq collections
1.6 jmc 122: containing the item.
123: Each collection in turn is also identified by page, and
1.4 nate 124: the usage within that page.
125: .Pp
126: On the
127: .Nm
128: command line the page name is separated from the usage name with the character
1.7 jmc 129: .Sq Cm \&: .
1.4 nate 130: The collections are separated by the character
1.7 jmc 131: .Sq Cm \&. .
1.4 nate 132: .Pp
133: As an alternative notation in items on the command line, the native numeric
134: value for the page name or usage can be used instead of the full human
1.6 jmc 135: readable page name or usage name.
136: Numeric values can be specified in decimal, octal or hexadecimal.
1.8 jmc 137: .Sh FILES
138: .Bl -tag -width "/usr/share/misc/usb_hid_usages"
139: .It Pa /usr/share/misc/usb_hid_usages
140: The default HID usage table.
141: .El
1.4 nate 142: .Sh EXAMPLES
143: On a standard USB mouse the item
1.8 jmc 144: .Pp
1.4 nate 145: .Dl Generic_Desktop:Mouse.Generic_Desktop:Pointer.Button:Button_2
1.8 jmc 146: .Pp
1.6 jmc 147: reflects the current status of button 2.
148: The
1.4 nate 149: .Qq button 2
150: item is encapsulated within two collections, the
151: .Qq Mouse
152: collection in the
153: .Qq Generic Desktop
154: page, and the
155: .Qq Pointer
156: collection in the
157: .Qq Generic Desktop
1.6 jmc 158: page.
159: The item itself is the usage
1.4 nate 160: .Qq Button_2
161: in the
162: .Qq Button
163: page.
164: .Pp
1.6 jmc 165: An item can generally be named by omitting one or more of the page names.
166: For example the
1.4 nate 167: .Qq button 2
168: item would usually just be referred to on the command line as:
1.8 jmc 169: .Pp
1.13 miod 170: .Dl $ usbhidctl -f /dev/wsmouse0 Mouse.Pointer.Button_2
1.4 nate 171: .Pp
172: Items can also be named by referring to parts of the item name with the
1.6 jmc 173: numeric representation of the native HID usage identifiers.
174: This is most useful when items are missing from the HID usage table.
175: The page identifier for the
1.4 nate 176: .Qq Generic Desktop
177: page is 1, and the usage identifier for the usage
178: .Qq Button_2
179: is 2, so the following can be used to refer to the
180: .Qq button 2
181: item:
1.8 jmc 182: .Pp
1.13 miod 183: .Dl $ usbhidctl -f /dev/wsmouse0 1:Mouse.1:Pointer.Button:2
1.4 nate 184: .Pp
185: Devices with human interface outputs can be manipulated with the
186: .Fl w
1.6 jmc 187: option.
188: For example, some USB mice have a Light Emitting Diode under software
1.4 nate 189: control as usage 2 under page 0xffff, in the
190: .Qq Mouse
1.6 jmc 191: collection.
192: The following can be used to switch this LED off:
1.8 jmc 193: .Pp
1.13 miod 194: .Dl $ usbhidctl -f /dev/wsmouse0 -w Mouse.0xffff:2=0
1.1 pvalchev 195: .Sh SEE ALSO
1.4 nate 196: .Xr usbhidaction 1 ,
1.3 pvalchev 197: .Xr usbhid 3 ,
1.1 pvalchev 198: .Xr uhid 4 ,
199: .Xr usb 4
200: .Sh HISTORY
201: The
202: .Nm
203: command first appeared in
204: .Ox 3.0 .
1.4 nate 205: .Sh AUTHORS
1.14 schwarze 206: .An David Sainty Aq Mt David.Sainty@dtsp.co.nz
1.1 pvalchev 207: .Sh BUGS
1.4 nate 208: Some USB HID devices report multiple items with exactly the same usage
1.6 jmc 209: identifiers.
210: The current naming scheme does not provide the means to specify
1.4 nate 211: which of a set of identically named items you are referring to.