usbhidctl(1)

usbhidctl1

Manipulate usb hid devices

Usage

usbhidctl -f device [-t table] [-alv]

usbhidctl -f device [-t table] [-v] -r

usbhidctl -f device [-t table] [-lnv] name ...

usbhidctl -f device [-t table] -w name=value ...

usbhidctl -f device -R

On the usbhidctl command line the page name is separated from the usage name with the character ‘:’. The collections are separated by the character ‘.’.

Overview

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 usbhidctl prints 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 given values.

The options are as follows:

-a

Show all items and their current values. This option fails if the device does not support the GET_REPORT command. This is the default, if no parameters other than -f are given to usbhidctl.

-f device

Specify a path name for the device to operate on. If device is numeric, it is taken to be the USB HID device number. If it is a relative path, it is taken to be the name of the device under /dev. An absolute path is taken to be the literal device pathname.

-l

Loop and dump the device data every time it changes. Only 'input' items are displayed in this mode.

-n

Suppress printing of the item name when querying specific items. Only output the current value.

-R

Dump the raw USB HID report descriptor data as hexadecimal bytes.

-r

Dump the USB HID report descriptor.

-t table

Specify a path name for the HID usage table file.

-v

Be verbose. Repeating this option increases verbosity.

-w

Change item values. Only 'output' and 'feature' kinds can be set with this option.

Files

/usr/share/misc/usb_hid_usages

The default HID usage table.

Examples

On a standard USB mouse the item

Generic_Desktop:Mouse.Generic_Desktop:Pointer.Button:Button_2

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 off:

$ usbhidctl -f /dev/wsmouse0 -w Mouse.0xffff:2=0

Releases

52 releases since OpenBSD 3.0; the text changed 12 times.

  1. 3.0
  2. 3.1
  3. 3.2
  4. 3.3
  5. 3.4–3.5
  6. 3.6–4.1
  7. 4.2–4.3
  8. 4.4
  9. 4.5–4.7
  10. 4.8–5.3
  11. 5.4–6.9
  12. 7.0
  13. 7.1–8.0

-R since OpenBSD 7.0.

History

The usbhidctl command first appeared in OpenBSD 3.0.

Authors

David Sainty ⟨[email protected]⟩

Bugs

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.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.