1 .\" $NetBSD: usbhidctl.1,v 1.21 2006/10/26 11:12:13 wiz Exp $
3 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by David Sainty <David.Sainty@dtsp.co.nz>
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd manipulate USB HID devices
60 can be used to output or modify the state of a USB HID (Human Interface
62 If a list of items is present on the command line, then
64 prints the current value of those items for the specified device.
69 attempts to set the specified items to the given values.
71 The options are as follows:
74 Show all items and their current values.
75 This option fails if the device does not support the
79 Specify a path name for the device to operate on.
82 is numeric, it is taken to be the USB HID device number.
84 path, it is taken to be the name of the device under
86 An absolute path is taken to be the literal device pathname.
88 Loop and dump the device data every time it changes.
89 Only 'input' items are displayed in this mode.
91 Suppress printing of the item name when querying specific items.
92 Only output the current value.
94 Dump the USB HID report descriptor.
96 Specify a path name for the HID usage table file.
99 Repeating this option increases verbosity.
102 Only 'output' and 'feature' kinds can be set with this
105 Reset all feature and output flags to zero before attempting to change them.
106 May be required for changing item values (via
108 on devices that don't implement
112 .Pa /usr/share/misc/usb_hid_usages
113 The default HID usage table.
116 parses the names of items specified on the command line against the human
117 interface items reported by the USB device.
118 Each human interface item is
119 mapped from its native form to a human readable name, using the HID usage
121 Command line items are compared with the generated item names,
122 and the USB HID device is operated on when a match is found.
124 Each human interface item is named by the
128 within that page, and the list of
131 Each collection in turn is also identified by page, and
132 the usage within that page.
136 command line the page name is separated from the usage name with the character
138 The collections are separated by the character
141 As an alternative notation in items on the command line, the native numeric
142 value for the page name or usage can be used instead of the full human
143 readable page name or usage name.
144 Numeric values can be specified in decimal,
145 octal or hexadecimal.
147 Some devices give the same name to more than one item.
149 supports isolating each item by appending a
151 character and a decimal item instance number, starting at zero.
153 On a standard USB mouse the item
154 .Dl Generic_Desktop:Mouse.Generic_Desktop:Pointer.Button:Button_2
155 reflects the current status of button 2.
158 item is encapsulated within two collections, the
167 The item itself is the usage
173 An item can generally be named by omitting one or more of the page names.
176 item would usually just be referred to on the command line as:
177 .Dl usbhidctl -f /dev/mouse Mouse.Pointer.Button_2
179 Items can also be named by referring to parts of the item name with the
180 numeric representation of the native HID usage identifiers.
182 useful when items are missing from the HID usage table.
183 The page identifier for the
185 page is 1, and the usage identifier for the usage
187 is 2, so the following can be used to refer to the
190 .Dl usbhidctl -f /dev/mouse 1:Mouse.1:Pointer.Button:2
192 Devices with human interface outputs can be manipulated with the
195 For example, some USB mice have a Light Emitting Diode under software
196 control as usage 2 under page 0xffff, in the
199 The following can be used to switch this LED off:
200 .Dl usbhidctl -f /dev/mouse -w Mouse.0xffff:2=0
202 The output below is from a device that uses the same name repeatedly.
203 .Bd -literal -offset indent
204 % usbhidctl -f /dev/uhid0 -a
205 Consumer_Control.Volume_Up=0
206 Consumer_Control.Volume_Down=0
207 Consumer_Control.Mute=0
208 Consumer_Control.Unassigned=0
209 Consumer_Control.Unassigned=0
213 .Qq Consumer_Control.Unassigned
215 Each can be individually accessed by providing an instance number.
216 For example, to set the value for the first item:
217 .Dl usbhidctl -f /dev/uhid0 -w 'Consumer_Control.Unassigned#0=1'
226 command first appeared in
229 .An David Sainty Aq David.Sainty@dtsp.co.nz