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