1.\" $OpenBSD: usbhidctl.1,v 1.7 2003/07/02 09:11:51 jmc Exp $ 2.\" $NetBSD: usbhidctl.1,v 1.14 2001/12/28 17:49:32 augustss Exp $ 3.\" 4.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 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 45.Nm 46.Fl f Ar device 47.Op Fl t Ar table 48.Op Fl l 49.Op Fl v 50.Fl a 51.Pp 52.Nm 53.Fl f Ar device 54.Op Fl t Ar table 55.Op Fl v 56.Fl r 57.Pp 58.Nm 59.Fl f Ar device 60.Op Fl t Ar table 61.Op Fl l 62.Op Fl n 63.Op Fl v 64.Op Ar item ... 65.Pp 66.Nm 67.Fl f Ar device 68.Op Fl t Ar table 69.Fl w 70.Op Ar item=value ... 71.Sh DESCRIPTION 72.Nm 73can be used to output or modify the state of a USB HID (Human Interface Device). 74If a list of items is present on the command line, then 75.Nm 76prints the current value of those items for the specified device. 77If the 78.Fl w 79flag is specified 80.Nm 81attempts to set the specified items to the given values. 82.Pp 83The options are as follows: 84.Bl -tag -width Ds 85.It Fl a 86Show all items and their current values. 87This option fails if the device does not support the GET_REPORT command. 88.It Fl f Ar device 89Specify a path name for the device to operate on. 90If 91.Ar device 92is numeric, it is taken to be the USB HID device number. 93If it is a relative path, it is taken to be the name of the device under 94.Pa /dev . 95An absolute path is taken to be the literal device pathname. 96.It Fl l 97Loop and dump the device data every time it changes. 98Only 'input' items are displayed in this mode. 99.It Fl n 100Suppress printing of the item name when querying specific items. 101Only output the current value. 102.It Fl r 103Dump the USB HID report descriptor. 104.It Fl t Ar table 105Specify a path name for the HID usage table file. 106.It Fl v 107Be verbose. 108Repeating this option increases verbosity. 109.It Fl w 110Change item values. 111Only 'output' and 'feature' kinds can be set with this option. 112.El 113.Sh FILES 114.Pa /usr/share/misc/usb_hid_usages 115The default HID usage table. 116.Sh SYNTAX 117.Nm 118parses the names of items specified on the command line against the human 119interface items reported by the USB device. 120Each human interface item is mapped from its native form to a human readable 121name, using the HID usage table 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.Sq Cm \&: . 139The collections are separated by the character 140.Sq Cm \&. . 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, octal or hexadecimal. 146.Sh EXAMPLES 147On a standard USB mouse the item 148.Dl Generic_Desktop:Mouse.Generic_Desktop:Pointer.Button:Button_2 149reflects the current status of button 2. 150The 151.Qq button 2 152item is encapsulated within two collections, the 153.Qq Mouse 154collection in the 155.Qq Generic Desktop 156page, and the 157.Qq Pointer 158collection in the 159.Qq Generic Desktop 160page. 161The item itself is the usage 162.Qq Button_2 163in the 164.Qq Button 165page. 166.Pp 167An item can generally be named by omitting one or more of the page names. 168For example the 169.Qq button 2 170item would usually just be referred to on the command line as: 171.Dl $ usbhidctl -f /dev/mouse Mouse.Pointer.Button_2 172.Pp 173Items can also be named by referring to parts of the item name with the 174numeric representation of the native HID usage identifiers. 175This is most useful when items are missing from the HID usage table. 176The page identifier for the 177.Qq Generic Desktop 178page is 1, and the usage identifier for the usage 179.Qq Button_2 180is 2, so the following can be used to refer to the 181.Qq button 2 182item: 183.Dl $ usbhidctl -f /dev/mouse 1:Mouse.1:Pointer.Button:2 184.Pp 185Devices with human interface outputs can be manipulated with the 186.Fl w 187option. 188For example, some USB mice have a Light Emitting Diode under software 189control as usage 2 under page 0xffff, in the 190.Qq Mouse 191collection. 192The following can be used to switch this LED off: 193.Dl $ usbhidctl -f /dev/mouse -w Mouse.0xffff:2=0 194.Sh SEE ALSO 195.Xr usbhidaction 1 , 196.Xr usbhid 3 , 197.Xr uhid 4 , 198.Xr usb 4 199.Sh HISTORY 200The 201.Nm 202command first appeared in 203.Ox 3.0 . 204.Sh AUTHORS 205.An David Sainty Aq David.Sainty@dtsp.co.nz 206.Sh BUGS 207Some USB HID devices report multiple items with exactly the same usage 208identifiers. 209The current naming scheme does not provide the means to specify 210which of a set of identically named items you are referring to. 211