1.\" $NetBSD: usbhidctl.1,v 1.14 2001/12/28 17:49:32 augustss 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). If a list of items is present on the command line, then 71.Nm 72prints the current value of those items for the specified device. If the 73.Fl w 74flag is specified 75.Nm 76attempts to set the specified items to the given values. 77.Pp 78The options are as follows: 79.Bl -tag -width Ds 80.It Fl a 81Show all items and their current values. 82This option fails if the device does not support the GET_REPORT command. 83.It Fl f Ar device 84Specify a path name for the device to operate on. If 85.Ar device 86is numeric, it is taken to be the USB HID device number. If it is a relative 87path, it is taken to be the name of the device under 88.Pa /dev . 89An absolute path is taken to be the literal device pathname. 90.It Fl l 91Loop and dump the device data every time it changes. Only 'input' items are 92displayed in this mode. 93.It Fl n 94Suppress printing of the item name when querying specific items. Only output 95the current value. 96.It Fl r 97Dump the USB HID report descriptor. 98.It Fl t Ar table 99Specify a path name for the HID usage table file. 100.It Fl v 101Be verbose. Repeating this option increases verbosity. 102.It Fl w 103Change item values. Only 'output' and 'feature' kinds can be set with this 104option. 105.El 106.Sh FILES 107.Pa /usr/share/misc/usb_hid_usages 108The default HID usage table. 109.Sh SYNTAX 110.Nm 111parses the names of items specified on the command line against the human 112interface items reported by the USB device. Each human interface item is 113mapped from its native form to a human readable name, using the HID usage 114table file. Command line items are compared with the generated item names, 115and the USB HID device is operated on when a match is found. 116.Pp 117Each human interface item is named by the 118.Qq page 119it appears in, the 120.Qq usage 121within that page, and the list of 122.Qq collections 123containing the item. Each collection in turn is also identified by page, and 124the usage within that page. 125.Pp 126On the 127.Nm 128command line the page name is separated from the usage name with the character 129.Cm So : Sc . 130The collections are separated by the character 131.Cm So . Sc . 132.Pp 133As an alternative notation in items on the command line, the native numeric 134value for the page name or usage can be used instead of the full human 135readable page name or usage name. Numeric values can be specified in decimal, 136octal or hexadecimal. 137.Sh EXAMPLES 138On a standard USB mouse the item 139.Dl Generic_Desktop:Mouse.Generic_Desktop:Pointer.Button:Button_2 140reflects the current status of button 2. The 141.Qq button 2 142item is encapsulated within two collections, the 143.Qq Mouse 144collection in the 145.Qq Generic Desktop 146page, and the 147.Qq Pointer 148collection in the 149.Qq Generic Desktop 150page. The item itself is the usage 151.Qq Button_2 152in the 153.Qq Button 154page. 155.Pp 156An item can generally be named by omitting one or more of the page names. For 157example the 158.Qq button 2 159item would usually just be referred to on the command line as: 160.Dl usbhidctl -f /dev/mouse Mouse.Pointer.Button_2 161.Pp 162Items can also be named by referring to parts of the item name with the 163numeric representation of the native HID usage identifiers. This is most 164useful when items are missing from the HID usage table. The page identifier 165for the 166.Qq Generic Desktop 167page is 1, and the usage identifier for the usage 168.Qq Button_2 169is 2, so the following can be used to refer to the 170.Qq button 2 171item: 172.Dl usbhidctl -f /dev/mouse 1:Mouse.1:Pointer.Button:2 173.Pp 174Devices with human interface outputs can be manipulated with the 175.Fl w 176option. For example, some USB mice have a Light Emitting Diode under software 177control as usage 2 under page 0xffff, in the 178.Qq Mouse 179collection. The following can be used to switch this LED off: 180.Dl usbhidctl -f /dev/mouse -w Mouse.0xffff:2=0 181.Sh SEE ALSO 182.Xr usbhidaction 1 , 183.Xr usbhid 3 , 184.Xr uhid 4 , 185.Xr usb 4 186.Sh HISTORY 187The 188.Nm 189command first appeared in 190.Nx 1.4 . 191.Sh AUTHORS 192.An David Sainty Aq David.Sainty@dtsp.co.nz 193.Sh BUGS 194Some USB HID devices report multiple items with exactly the same usage 195identifiers. The current naming scheme does not provide the means to specify 196which of a set of identically named items you are referring to. 197