1HWDB(7) hwdb HWDB(7)
2
3
4
6 hwdb - Hardware Database
7
9 The hardware database is a key-value store for associating
10 modalias-like keys to udev-property-like values. It is used primarily
11 by udev to add the relevant properties to matching devices, but it can
12 also be queried directly.
13
15 The hwdb files are read from the files located in the system hwdb
16 directory /usr/lib/udev/hwdb.d and the local administration directory
17 /etc/udev/hwdb.d. All hwdb files are collectively sorted and processed
18 in lexical order, regardless of the directories in which they live.
19 However, files with identical filenames replace each other. Files in
20 /etc have the highest priority and take precedence over files with the
21 same name in /usr/lib. This can be used to override a system-supplied
22 hwdb file with a local file if needed; a symlink in /etc with the same
23 name as a hwdb file in /usr/lib, pointing to /dev/null, disables that
24 hwdb file entirely. hwdb files must have the extension .hwdb; other
25 extensions are ignored.
26
27 Each hwdb file contains data records consisting of matches and
28 associated key-value pairs. Every record in the hwdb starts with one or
29 more match strings, specifying a shell glob to compare the lookup
30 string against. Multiple match lines are specified in consecutive
31 lines. Every match line is compared individually, and they are combined
32 by OR. Every match line must start at the first character of the line.
33
34 The match lines are followed by one or more key-value pair lines, which
35 are recognized by a leading space character. The key name and value are
36 separated by "=". An empty line signifies the end of a record. Lines
37 beginning with "#" are ignored.
38
39 In case multiple records match a given lookup string, the key-value
40 pairs from all records are combined. If a key is specified multiple
41 times, the value from the record with the highest priority is used
42 (each key can have only a single value). The priority is higher when
43 the record is in a file that sorts later lexicographically, and in case
44 of records in the same file, later records have higher priority.
45
46 The content of all hwdb files is read by systemd-hwdb(8) and compiled
47 to a binary database located at /etc/udev/hwdb.bin, or alternatively
48 /usr/lib/udev/hwdb.bin if you want ship the compiled database in an
49 immutable image. During runtime, only the binary database is used.
50
52 Example 1. General syntax of hwdb files
53
54 # /usr/lib/udev/hwdb.d/example.hwdb
55 # Comments can be placed before any records. This is a good spot
56 # to describe what that file is used for, what kind of properties
57 # it defines, and the ordering convention.
58
59 # A record with three matches and one property
60 mouse:*:name:*Trackball*:
61 mouse:*:name:*trackball*:
62 mouse:*:name:*TrackBall*:
63 ID_INPUT_TRACKBALL=1
64
65 # A record with a single match and five properties
66 mouse:usb:v046dp4041:name:Logitech MX Master:
67 MOUSE_DPI=1000@166
68 MOUSE_WHEEL_CLICK_ANGLE=15
69 MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL=26
70 MOUSE_WHEEL_CLICK_COUNT=24
71 MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL=14
72
73 Example 2. Overriding of properties
74
75 # /usr/lib/udev/hwdb.d/60-keyboard.hwdb
76 evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pn*
77 KEYBOARD_KEY_a1=help
78 KEYBOARD_KEY_a2=setup
79 KEYBOARD_KEY_a3=battery
80
81 evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pn123*
82 KEYBOARD_KEY_a2=wlan
83
84 # /etc/udev/hwdb.d/70-keyboard.hwdb
85 # disable wlan key on all at keyboards
86 evdev:atkbd:*
87 KEYBOARD_KEY_a2=reserved
88
89 If the hwdb consists of those two files, a keyboard with the lookup
90 string "evdev:atkbd:dmi:bvnAcer:bdXXXXX:bd08/05/2010:svnAcer:pn123"
91 will match all three records, and end up with the following properties:
92
93 KEYBOARD_KEY_a1=help
94 KEYBOARD_KEY_a2=reserved
95 KEYBOARD_KEY_a3=battery
96
98 systemd-hwdb(8)
99
100
101
102systemd 241 HWDB(7)