LinuxCommandLibrary

hwdb

TLDR

Update hardware database

$ sudo systemd-hwdb update
copy
Query device properties
$ systemd-hwdb query [modalias]
copy
Show hardware database path
$ systemd-hwdb --help
copy

SYNOPSIS

systemd-hwdb [options] command

DESCRIPTION

hwdb (Hardware Database) is a systemd component that maps hardware properties to udev device attributes. It matches hardware by modalias strings and sets properties like device names, permissions, and driver hints.
The database is compiled from text files in /usr/lib/udev/hwdb.d/ and /etc/udev/hwdb.d/ into a binary format for fast matching.

PARAMETERS

update

Compile hwdb files to binary.
query modalias
Query properties for modalias.
--path path
Custom hwdb path.
--root root
Root directory.
--strict
Strict parsing mode.
--usr
Use /usr directory.

HWDB FILE FORMAT

$ # /etc/udev/hwdb.d/70-custom.hwdb
# Match USB keyboard
usb:v04D9p1702*
 KEYBOARD_KEY_70039=leftctrl
 KEYBOARD_KEY_3a=capslock

# Match by PCI ID
pci:v00001234d00005678*
 ID_VENDOR=Custom Vendor
copy

USAGE

$ # Update after editing hwdb files
sudo systemd-hwdb update
sudo udevadm trigger

# Find modalias for device
udevadm info /dev/input/event0 | grep MODALIAS
copy

CAVEATS

Changes require hwdb update and udevadm trigger. Modalias format varies by bus type. Incorrect entries may cause device issues.

SEE ALSO

Copied to clipboard