Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Add custom udev hardware definition for extra keys on keyboard

My old HP keyboard has an extra row of buttons, with icons like "camera" and "music" and "shopping cart." On my exact keyboard, only the globe, magnifying glass, and envelope buttons register. Well, I finally decided to do something about it, and of course the Arch wiki has some great info. The process is more important than the output, because everybody's hardware is different.

# File: /etc/udev/hwdb.d/60-keyboard-hp5183.hwdb
# Locations:
#    /mnt/public/Support/Systems/hp-5183-keyboard/60-keyboard-hp5183.hwdb
# Author: bgstack15
# Startdate: 2021-06-04
# Title: Udev definition for extra keys on HP 5183 keyboard
# Purpose: Allow use of the extra keys on the keyboard
# Usage:
#    Place this file in /etc/udev/hwdb.d/
#    modify /usr/lib/systemd/system/systemd-hwdb-update.service by commenting out ConditionNeedsUpdate=/etc
#    sudo systemctl daemon-reload (only after that first modification to that service file)
#    sudo systemd-hwdb update
#    sudo udevadm trigger
#    Validate with: udevadm info /dev/input/by-path/platform-i8042-serio-0-event-kbd | grep KEYBOARD_KEY
# Reference:
#    evemu(1) provides the name of the device, which you prepend with "evdev:atkbd:" and trim some stuff off at the en
d.
#    /usr/lib/udev/hwdb.d/60-keyboard.hwdb
#    https://wiki.archlinux.org/title/Map_scancodes_to_keycodes
#    https://wiki.archlinux.org/title/Keyboard_input
#    just visit the CTRL+ALT+F2 console and press the keys that are not mappable/registered for xev.
#    /usr/include/linux/input-event-codes.h provides the basis for key names
#    example files at /usr/lib/udev/hwdb.d/60-keyboard.hwdb are best
evdev:atkbd:dmi:bvnHewlett-Packard:bvrK01v02.05:bd05/07/2012:br2.5:svnHewlett-Packard:pnHPCompaqElite8300SFF:pvr*
 KEYBOARD_KEY_9f=camera          # camera
 KEYBOARD_KEY_96=media           # music
 KEYBOARD_KEY_b9=switchvideomode # camcorder
 KEYBOARD_KEY_94=prog1           # "hp"
# b4 already defined: globe
 KEYBOARD_KEY_a6=help            # question mark
# e1 already defined: magnifying glass
 KEYBOARD_KEY_9e=shop            # shopping cart
# a3 already defined: mail

References

Weblinks

Local files

  1. /usr/lib/udev/hwdb.d/60-keyboard.hwdb
  2. /usr/include/linux/input-event-codes.h provides the basis for key names
  3. /usr/lib/udev/hwdb.d/60-keyboard.hwdb has the best examples

Comments