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 Match patterns consist of literal characters, and shell-style
35 wildcards:
36
37 • Asterisk "*" matches any number of characters
38
39 • Question mark "?" matches a single character
40
41 • Character list "[chars]" matches one of the characters chars listed
42 between "[" and "]". A range may be specified as with a dash as
43 "[first-last]". The match may be inverted with a caret "[^...]".
44
45 The match lines are followed by one or more key-value pair lines, which
46 are recognized by a leading space character. The key name and value are
47 separated by "=". An empty line signifies the end of a record. Lines
48 beginning with "#" are ignored.
49
50 In case multiple records match a given lookup string, the key-value
51 pairs from all records are combined. If a key is specified multiple
52 times, the value from the record with the highest priority is used
53 (each key can have only a single value). The priority is higher when
54 the record is in a file that sorts later lexicographically, and in case
55 of records in the same file, later records have higher priority.
56
57 The content of all hwdb files is read by systemd-hwdb(8) and compiled
58 to a binary database located at /etc/udev/hwdb.bin, or alternatively
59 /usr/lib/udev/hwdb.bin if you want ship the compiled database in an
60 immutable image. During runtime, only the binary database is used.
61
63 Example 1. General syntax of hwdb files
64
65 # /usr/lib/udev/hwdb.d/example.hwdb
66 # Comments can be placed before any records. This is a good spot
67 # to describe what that file is used for, what kind of properties
68 # it defines, and the ordering convention.
69
70 # A record with three matches and one property
71 mouse:*:name:*Trackball*:*
72 mouse:*:name:*trackball*:*
73 mouse:*:name:*TrackBall*:*
74 ID_INPUT_TRACKBALL=1
75
76 # The rule above could be also be written in a form that
77 # matches Tb, tb, TB, tB:
78 mouse:*:name:*[tT]rack[bB]all*:*
79 ID_INPUT_TRACKBALL=1
80
81 # A record with a single match and five properties
82 mouse:usb:v046dp4041:name:Logitech MX Master:*
83 MOUSE_DPI=1000@166
84 MOUSE_WHEEL_CLICK_ANGLE=15
85 MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL=26
86 MOUSE_WHEEL_CLICK_COUNT=24
87 MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL=14
88
89 Example 2. Overriding of properties
90
91 # /usr/lib/udev/hwdb.d/60-keyboard.hwdb
92 evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pn*:*
93 KEYBOARD_KEY_a1=help
94 KEYBOARD_KEY_a2=setup
95 KEYBOARD_KEY_a3=battery
96
97 # Match vendor name "Acer" and any product name starting with "X123"
98 evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer:pnX123*:*
99 KEYBOARD_KEY_a2=wlan
100
101 # /etc/udev/hwdb.d/70-keyboard.hwdb
102 # disable wlan key on all at keyboards
103 evdev:atkbd:*
104 KEYBOARD_KEY_a2=reserved
105 PROPERTY_WITH_SPACES=some string
106
107 If the hwdb consists of those two files, a keyboard with the lookup
108 string "evdev:atkbd:dmi:bvnAcer:bdXXXXX:bd08/05/2010:svnAcer:pnX123"
109 will match all three records, and end up with the following properties:
110
111 KEYBOARD_KEY_a1=help
112 KEYBOARD_KEY_a2=reserved
113 KEYBOARD_KEY_a3=battery
114 PROPERTY_WITH_SPACES=some string
115
117 systemd-hwdb(8)
118
119
120
121systemd 248 HWDB(7)