| USBHIDCTL(1) | General Commands Manual | USBHIDCTL(1) | 
usbhidctl —
| usbhidctl | -fdevice
      [-ttable]
      [-lv]-a | 
| usbhidctl | -fdevice
      [-ttable]
      [-v]-r | 
| usbhidctl | -fdevice
      [-ttable]
      [-lnv] item [...] | 
| usbhidctl | -fdevice
      [-ttable]
      [-z]-witem=value [...] | 
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:
-aGET_REPORT command.-f
    device-l-n-r-t
    table-v-w-z-w) on devices that don't implement
      GET_REPORT.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.
On the 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.
Some devices give the same name to more than one item.
    usbhidctl supports isolating each item by appending
    a ‘#’. character and a decimal item
    instance number, starting at zero.
Generic_Desktop:Mouse.Generic_Desktop:Pointer.Button:Button_2An 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/mouse
  Mouse.Pointer.Button_2Items 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/mouse
  1:Mouse.1:Pointer.Button:2Devices 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/mouse -w
  Mouse.0xffff:2=0The output below is from a device that uses the same name repeatedly.
% usbhidctl -f /dev/uhid0 -a Consumer_Control.Volume_Up=0 Consumer_Control.Volume_Down=0 Consumer_Control.Mute=0 Consumer_Control.Unassigned=0 Consumer_Control.Unassigned=0
The “Consumer_Control.Unassigned” name is used twice. Each can be individually accessed by providing an instance number. For example, to set the value for the first item:
usbhidctl -f /dev/uhid0 -w
  'Consumer_Control.Unassigned#0=1'Another example is configuring multimedia keys on a keyboard.
    First you would look in the
    dmesg(8) output, which
    uhid(4) devices are attached to
    the keyboard's uhidev(4)
    device and use usbhidctl to see how the controls are
    reported:
usbhidctl -f /dev/uhidX -lv
  -aConsumer:Volume_Up etc. Then create a configuration
  file containing the actions, like:
Consumer:Volume_Up 1 /usr/pkg/bin/dcop amarok player volumeUp & Consumer:Volume_Down 1 /usr/pkg/bin/dcop amarok player volumeDown & Consumer:Mute 1 /usr/pkg/bin/dcop amarok player mute &
usbhidaction -c /path/to/file -f
  /dev/uhidXusbhidctl command first appeared in
  NetBSD 1.4.
| March 30, 2011 | NetBSD 10.1 |