Enabling usbhid
usbhid(4) gives the ability to use newer advanced hid drivers. The ability to use usbhid must be turned on from /boot/loader.conf:
Then, load the driver through /etc/rc.conf:
Turning this module on from /boot/loader.conf won't work. Once this is turned on, the other drivers will automatically load according to your hardware on the next boot up. This works on FreeBSD 13.1-Beta, so it may have to be tested from FreeBSD 13.0. On future releases of FreeBSD, enabling usbhid ability from loader.conf may likely no longer be necessary.
Multimedia keys
Once usbhid loads on bootup, hcons(4) automatically starts up, provided there's a corresponding hardware device with multimedia keys.
x11/xev works from the Xorg desktop. Get the keycode number with
Run
In these examples,"XF86Audio" is part of the name of the keys that would be used in hotkeys for window managers and desktop applications. Audio level controls are typically more specific to commands, for instance mixer(8), through a window manager. Depending on keyboard, some entries like calculator and mail may need the FN key. In my window manager, I associated the calculator with xcalc(1). An entry for a window manager configuration file may include
hsctrl(4) is a driver that works for power on/off keys. hkbd(4) is for i2c keypads.
Game control drivers
Game control drivers compatible with usbhid that have been moved into base of FreeBSD 13.x: hgame(4), ps4dshock(4), xb360gp(4).
usbhid(4) gives the ability to use newer advanced hid drivers. The ability to use usbhid must be turned on from /boot/loader.conf:
Code:
hw.usb.usbhid.enable="1"
Code:
kld_list="usbhid"
Multimedia keys
Once usbhid loads on bootup, hcons(4) automatically starts up, provided there's a corresponding hardware device with multimedia keys.
x11/xev works from the Xorg desktop. Get the keycode number with
xev
. | grep keycode
can be used with this. Sometimes it takes pressing a few multimedia keys at a time to get this output through xev(1) (this inconsistency is expected to be improved in the future). With other drivers and previous FreeBSD releases, this didn't produce a keycode for multimedia keys from certain keyboards. Now, it's expected to work with multimedia keys from more keyboards. Other keycode grabbers than xev, especially for the virtual console, don't seem to work for special keys. As of this writing, multimedia keys only work from the X.org desktop. When switching to terminal consoles, these keys don't work there.Run
xmodmap -pke
to see conventional entries of keycodes to multimedia and other keyboard functions. See xmodmap(1) for more details. Then, edit ~/.xmodmaprc, for example:
Code:
keycode 121 = XF86AudioMute
keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume
keycode 171 = XF86AudioNext
keycode 172 = XF86AudioPlay XF86AudioPause
keycode 173 = XF86AudioPrev
keycode 148 = XF86Calculator
key="XF86AudioMute"
. Hotkeys of pause/resume, next and previous for the audio application audio/deadbeef can be set through Edit -> Preferences -> Hotkeys.hsctrl(4) is a driver that works for power on/off keys. hkbd(4) is for i2c keypads.
Game control drivers
Game control drivers compatible with usbhid that have been moved into base of FreeBSD 13.x: hgame(4), ps4dshock(4), xb360gp(4).