|USBHIDCTL(1)||General Commands Manual||USBHIDCTL(1)|
manipulate USB HID devices
usbhidctl can be used to output or modify
the state of a USB HID (Human Interface Device). If a list of items is
present on the command line, then
the current value of those items for the specified device. If the
-w flag is specified
usbhidctl attempts to set the specified items to the
The options are as follows:
-fare given to
usbhidctl parses the names of items
specified on the command line against the human interface items reported by
the USB device. Each human interface item is mapped from its native form to
a human readable name, using the HID usage table file. Command line items
are compared with the generated item names, and the USB HID device is
operated on when a match is found.
Each human interface item is named by the "page" it appears in, the "usage" within that page, and the list of "collections" containing the item. Each collection in turn is also identified by page, and the usage within that page.
usbhidctl command line the page
name is separated from the usage name with the character
:’. The collections are separated by
the character ‘
As an alternative notation in items on the command line, the native numeric value for the page name or usage can be used instead of the full human readable page name or usage name. Numeric values can be specified in decimal, octal or hexadecimal.
On a standard USB mouse the item
reflects the current status of button 2. The "button 2" item is encapsulated within two collections, the "Mouse" collection in the "Generic Desktop" page, and the "Pointer" collection in the "Generic Desktop" page. The item itself is the usage "Button_2" in the "Button" page.
An item can generally be named by omitting one or more of the page names. For example the "button 2" item would usually just be referred to on the command line as:
$ usbhidctl -f /dev/wsmouse0 Mouse.Pointer.Button_2
Items can also be named by referring to parts of the item name with the numeric representation of the native HID usage identifiers. This is most useful when items are missing from the HID usage table. The page identifier for the "Generic Desktop" page is 1, and the usage identifier for the usage "Button_2" is 2, so the following can be used to refer to the "button 2" item:
$ usbhidctl -f /dev/wsmouse0 1:Mouse.1:Pointer.Button:2
Devices with human interface outputs can be manipulated with the
-w option. For example, some USB mice have a Light
Emitting Diode under software control as usage 2 under page 0xffff, in the
"Mouse" collection. The following can be used to switch this LED
$ usbhidctl -f /dev/wsmouse0 -w Mouse.0xffff:2=0
usbhidctl command first appeared in
David Sainty <David.Sainty@dtsp.co.nz>
Some USB HID devices report multiple items with exactly the same usage identifiers. The current naming scheme does not provide the means to specify which of a set of identically named items you are referring to.
|May 31, 2021||OpenBSD-current|