Annotation of src/usr.bin/usbhidctl/usbhidctl.1, Revision 1.8
1.8 ! jmc 1: .\" $OpenBSD: usbhidctl.1,v 1.7 2003/07/02 09:11:51 jmc 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: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the NetBSD
21: .\" Foundation, Inc. and its contributors.
22: .\" 4. Neither the name of The NetBSD Foundation nor the names of its
23: .\" contributors may be used to endorse or promote products derived
24: .\" from this software without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: .\" POSSIBILITY OF SUCH DAMAGE.
37: .\"
38: .Dd August 27, 2000
39: .Dt USBHIDCTL 1
40: .Os
41: .Sh NAME
42: .Nm usbhidctl
43: .Nd manipulate USB HID devices
44: .Sh SYNOPSIS
1.2 jakob 45: .Nm
1.1 pvalchev 46: .Fl f Ar device
47: .Op Fl t Ar table
1.8 ! jmc 48: .Op Fl lv
1.1 pvalchev 49: .Fl a
1.2 jakob 50: .Nm
1.1 pvalchev 51: .Fl f Ar device
52: .Op Fl t Ar table
53: .Op Fl v
54: .Fl r
1.2 jakob 55: .Nm
1.1 pvalchev 56: .Fl f Ar device
57: .Op Fl t Ar table
1.8 ! jmc 58: .Op Fl lnv
! 59: .Op Ar name ...
1.2 jakob 60: .Nm
1.1 pvalchev 61: .Fl f Ar device
62: .Op Fl t Ar table
63: .Fl w
1.8 ! jmc 64: .Op Ar name Ns = Ns Ar value ...
1.1 pvalchev 65: .Sh DESCRIPTION
66: .Nm
1.6 jmc 67: can be used to output or modify the state of a USB HID (Human Interface Device).
68: If a list of items is present on the command line, then
1.1 pvalchev 69: .Nm
1.6 jmc 70: prints the current value of those items for the specified device.
71: If the
1.1 pvalchev 72: .Fl w
73: flag is specified
74: .Nm
75: attempts to set the specified items to the given values.
76: .Pp
77: The options are as follows:
78: .Bl -tag -width Ds
79: .It Fl a
80: Show all items and their current values.
1.4 nate 81: This option fails if the device does not support the GET_REPORT command.
1.1 pvalchev 82: .It Fl f Ar device
1.6 jmc 83: Specify a path name for the device to operate on.
84: If
1.1 pvalchev 85: .Ar device
1.6 jmc 86: is numeric, it is taken to be the USB HID device number.
87: If it is a relative path, it is taken to be the name of the device under
1.1 pvalchev 88: .Pa /dev .
89: An absolute path is taken to be the literal device pathname.
90: .It Fl l
1.6 jmc 91: Loop and dump the device data every time it changes.
92: Only 'input' items are displayed in this mode.
1.1 pvalchev 93: .It Fl n
1.6 jmc 94: Suppress printing of the item name when querying specific items.
95: Only output the current value.
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.5 deraadt 170: .Dl $ usbhidctl -f /dev/mouse 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.5 deraadt 183: .Dl $ usbhidctl -f /dev/mouse 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.5 deraadt 194: .Dl $ usbhidctl -f /dev/mouse -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
206: .An David Sainty Aq 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.