chiark / gitweb /
[PATCH] minor grammer fixes for the udev_vs_devfs document
[elogind.git] / udev.8
1 .TH UDEV 8 "October 2003" "" "Linux Administrator's Manual"
2 .SH NAME
3 udev \- Linux configurable dynamic device naming support
4 .SH SYNOPSIS
5 .BI udev " hotplug-subsystem"
6 .br
7 .B udev
8 .RI "[-q " sysfs_path "] [-rVh]"
9 .SH "DESCRIPTION"
10 .B udev
11 creates or removes device node files usually located in the /dev directory.
12 Its goal is to provide a dynamic device directory that contains only the files
13 for devices that are actually present.
14 .P
15 As part of the
16 .B hotplug
17 subsystem,
18 .B udev
19 is executed if a kernel device is added or removed from the system.
20 On device creation,
21 .B udev
22 reads the sysfs directory of the given device to collect device attributes
23 like label, serial number or bus device number.
24 These attributes are treated as a key
25 to determine a unique name for device file creation.
26 .B udev
27 maintains a database for devices present on the system.
28 .br
29 On device removal,
30 .B udev
31 queries the internal database for the name of the device file to be deleted.
32 .SH "OPTIONS"
33 .B udev
34 normally is called by
35 .B hotplug
36 with the subsystem as argument and various environment variables set.
37 .br
38 It may also called with the following options:
39 .TP
40 .B -V
41 Print the version information.
42 .TP
43 .B -r
44 Print the the
45 .B udev
46 root directory.
47 .TP
48 .BI -q " sysfs_path"
49 Query with the sysfs path as argument for the name of the created device node.
50 .TP
51 .B -h
52 Print help text.
53 .SH "CONFIGURATION"
54 All
55 .B udev
56 configuration files consist of a set of lines of text.  All empty
57 lines, and lines beginning with a '#' will be ignored.
58 .P
59
60 .B udev
61 expects its main configuration file at
62 .I /etc/udev/udev.conf.
63 The file consists of a set of variables and values that allow the user to
64 override default udev values.  The current set of variables that can be
65 overridden in this file is:
66 .TP
67 .B udev_root
68 This is the where in the filesystem to place the device nodes.  The default
69 value for this is
70 .I /udev/
71 .TP
72 .B udev_db
73 The name and location of the udev database.  The default value for this is
74 .I /udev/.udev.tdb
75 .TP
76 .B udev_rules
77 This is the location of the udev rules file.  The default value for this is
78 .I /etc/udev/udev.rules
79 .TP
80 .B udev_permissions
81 This is the location of the udev permission file.  The default value for this is
82 .I /etc/udev/udev.permissions
83 .TP
84 .B default_mode
85 This is the default mode for all nodes that have no explicit match in the
86 permissions file.  The default value for this is
87 .I 0666
88 .br
89 .P
90 .RI "A sample " udev.conf " might look like this:
91 .sp
92 .nf
93 # udev_root - where in the filesystem to place the device nodes
94 udev_root="/udev/"
95
96 # udev_db - The name and location of the udev database.
97 udev_db="/udev/.udev.tdb"
98
99 # udev_rules - The name and location of the udev rules file
100 udev_rules="/etc/udev/udev.rules"
101
102 # udev_permissions - The name and location of the udev permission file
103 udev_permissions="/etc/udev/udev.permissions"
104
105 # default_mode - set the default mode for all nodes that have no
106 #                explicit match in the permissions file
107 default_mode="0666"
108 .fi
109 .P
110 The rules for udev to use when naming devices may specified at
111 .I /etc/udev/udev.rules
112 or specified by the
113 .I udev_rules
114 value in the
115 .I /etc/udev/udev.conf
116 file.
117 .P
118 Every line in the rules file define the mapping between device attributes and
119 the device file name. It starts with a keyword defining the method used to
120 match, followed by one ore more keys to compare and the filename for the
121 device. One ore more optional symlinks targeting the node may be specified.
122 .br
123 If no matching configuration is found, the default kernel device name
124 is used.
125 .P
126 The line format is:
127 .sp
128 .I method, key,[key,...] name [, symlink]
129 .sp
130 where valid methods with corresponding keys are:
131 .TP
132 .B CALLOUT
133 calling external program, that returns a string to match.  The
134 .B BUS
135 key is optional, but if specified, the sysfs device bus must be able to be
136 determined by a "device" symlink.
137 .br
138 .RB "keys: " BUS ", " PROGRAM ", " ID
139 .TP
140 .B LABEL
141 device label or serial number, like USB serial number, SCSI UUID or
142 file system label.  Up to 5 different sysfs files can be checked, with
143 all of the values being required in order to match the rule.  The
144 .B BUS
145 key is optional, but if specified, the sysfs device bus must be able to be
146 detemined by a "device" symlink.
147 .br
148 .RB "keys: " BUS ", " SYSFS_
149 .TP
150 .B NUMBER
151 device number on the bus, like PCI bus id
152 .br
153 .RB "keys: " BUS ", " ID
154 .TP
155 .B TOPOLOGY
156 device position on bus, like physical port of USB device
157 .br
158 .RB "keys: " BUS ", " PLACE
159 .TP
160 .B REPLACE
161 string replacement of the kernel device name
162 .br
163 .RB "key: " KERNEL
164 .P
165 The methods are applied in the following order:
166 .BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "."
167 .P
168 .RB "The " NAME " ," SYMLINK " and " PROGRAM
169 fields support simple printf-like string substitution:
170 .TP
171 .B %n
172 The "kernel number" of the device.
173 for example, 'sda3' has a "kernel number" of '3'
174 .TP
175 .B %k
176 The "kernel name" for the device.
177 .TP
178 .B %M
179 The kernel major number for the device.
180 .TP
181 .B %m
182 The kernel minor number for the device.
183 .TP
184 .B %b
185 The bus id for the device.
186 .TP
187 .B %c
188 The CALLOUT program returned string.
189 (This does not work within the PROGRAM field for the obvious reason.)
190 .TP
191 .B %D
192 Use the devfs style disk name for this device.
193 For partitions, this will result in 'part%n'
194 If this is not a partition, it will result in 'disc'.
195 .P
196 .RI "A sample " udev.rules " might look like this:"
197 .sp
198 .nf
199 # if /sbin/scsi_id returns "OEM 0815" device will be called disk1
200 CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1"
201
202 # USB printer to be called lp_color
203 LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color"
204
205 # SCSI disk with a specific vendor and model number is to be called boot
206 LABEL, BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n"
207
208 # sound card with PCI bus id 00:0b.0 to be called dsp
209 NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp"
210
211 # USB mouse at third port of the second hub to be called mouse1
212 TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1"
213
214 # ttyUSB1 should always be called pda with two additional symlinks
215 REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"
216
217 # multiple USB webcams with symlinks to be called webcam0, webcam1, ...
218 LABEL, BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n"
219 .fi
220 .P
221 Permissions and ownership for the created device files may specified at
222 .I /etc/udev/udev.permissions
223 or specified by the
224 .I udev_permission
225 value in the
226 .I /etc/udev/udev.conf
227 file.
228 .br
229 Every line lists a device name followed by owner, group and permission
230 mode. All values are separated by colons. The name field may contain a
231 pattern to apply the values to a whole class of devices.
232 .br
233 If
234 .B udev
235 was built using klibc or is used before the user database is accessible (e.g.
236 .BR initrd "(4)), only numeric owner and group values may be used."
237 .sp
238 .RI "A sample " udev.permissions " might look like this:"
239 .sp
240 .nf
241 #name:user:group:mode
242 input/*:root:root:644
243 ttyUSB1:0:8:0660
244 video*:root:video:0660
245 dsp1:::0666
246 .fi
247 .P
248 A number of different fields in the above configuration files support a simple
249 form of shell style pattern matching. It supports the following pattern characters:
250 .TP
251 .B *
252 Matches zero, one, or more characters.
253 .TP
254 .B ?
255 Matches any single character, but does not match zero characters.
256 .TP
257 .B [ ]
258 Matches any single character specified within the brackets. For example, the
259 pattern string "tty[SR]" would match either "ttyS" or "ttyR".  Ranges are also
260 supported within this match with the '-' character.  For example, to match on
261 the range of all digits, the pattern [0-9] would be used. If the first character
262 following the '[' is a '!' then any character not enclosed is matched.
263 .SH "FILES"
264 .nf
265 /sbin/udev                           udev program
266 /etc/udev/*                          udev config files
267 /etc/hotplug.d/default/udev.hotplug  hotplug symlink to udev program
268 .fi
269 .LP
270 .SH "SEE ALSO"
271 .BR hotplug (8)
272 .PP
273 The
274 .I http://linux-hotplug.sourceforge.net/
275 web site.
276 .SH AUTHORS
277 .B udev
278 was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
279 Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, and
280 many others.