chiark / gitweb /
1500b3b424d79a5e3f350043a269b154410bda26
[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 .SH "DESCRIPTION"
7 .B udev
8 creates or removes device node files usually located in the /dev directory.
9 Its goal is to provide a dynamic device directory that contains only the files
10 for devices that are actually present.
11 .P
12 As part of the
13 .B hotplug
14 subsystem,
15 .B udev
16 is executed if a kernel device is added or removed from the system.
17 On device creation,
18 .B udev
19 reads the sysfs directory of the given device to collect device attributes
20 like label, serial number or bus device number.
21 These attributes are treated as a key 
22 to determine a unique name for device file creation.
23 .B udev
24 maintains a database for devices present on the system.
25 .br
26 On device removal,
27 .B udev
28 queries the internal database for the name of the device file to be deleted.
29 .SH "CONFIGURATION"
30 .B udev
31 expects its configuration at
32 .I /etc/udev/udev.config.
33 The file consists of a set of lines. All empty lines and
34 lines beginning with a '#' will be ignored.
35 .br
36 Every line defines the mapping between device attributes and the device file
37 name. It starts with a keyword defining the method used to match, followed by
38 one ore more keys to compare and the filename for the device. If no matching
39 configuration is found, the default kernel device name is used.
40 .P
41 The line format is:
42 .RS
43 .sp
44 .I method, key,[key,...] name
45 .sp
46 .RE
47 where valid methods with corresponding keys are:
48 .TP
49 .B CALLOUT
50 calling external program, that returns a string to match
51 .br
52 keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP
53 .TP
54 .B LABEL
55 device label or serial number, like USB serial number, SCSI UUID or
56 file system label
57 .br
58 keys: \fBBUS\fP, \fIsysfs_attribute\fP
59 .TP
60 .B NUMBER
61 device number on the bus, like PCI bus id
62 .br
63 keys: \fBBUS\fP, \fBID\fP
64 .TP
65 .B TOPOLOGY
66 device position on bus, like physical port of USB device
67 .br
68 keys: \fBBUS\fP, \fBPLACE\fP
69 .TP
70 .B REPLACE
71 string replacement of the kernel device name
72 .br
73 key: \fBKERNEL_NAME\fP
74 .P
75 The methods are applied in the following order:
76 .B CALLOUT
77 ,
78 .B LABEL
79 ,
80 .B NUMBER
81 ,
82 .B TOPOLOGY
83 ,
84 .B REPLACE
85 .P
86 The 
87 .B NAME 
88 and 
89 .B PROGRAM 
90 fields support simple printf-like string subtitution:
91 .RS
92 .TP
93 .B %n
94 the "kernel number" of the device
95 for example, 'sda3' has a "kernel number" of '3'
96 .TP
97 .B %M
98 the kernel major number for the device
99 .TP
100 .B %m
101 the kernel minor number for the device
102 .TP
103 .B %b
104 the bus id for the device
105 .TP
106 .B %c
107 the CALLOUT program returned string
108 (this does not work within the PROGRAM field for the obvious reason.)
109 .RE
110 .P
111 A sample \fIudev.conf\fP might look like this:
112 .sp
113 .nf
114 # if /sbin/scsi_id returns "OEM 0815" device will be called disk1
115 CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1"
116
117 # USB printer to be called lp_color
118 LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_color"
119
120 # sound card with PCI bus id 00:0b.0 to be called dsp
121 NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp"
122
123 # USB mouse at third port of the second hub to be called mouse1
124 TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1"
125
126 # ttyUSB1 should always be called pda
127 REPLACE, KERNEL="ttyUSB1", NAME="pda"
128
129 # USB webcams to be called webcam0, webcam1, ...
130 LABEL, BUS="usb", model="WebCam Version 3", NAME="webcam%n"
131 .fi
132 .P
133 Permissions and ownership for the created device files may specified at
134 .I /etc/udev/udev.permissions.
135 The file consists of a set of lines. All empty lines and
136 lines beginning with a '#' will be ignored.
137 .br
138 Every line lists a device name followed by owner, group and permission
139 mode. All values are separated by colons. The name field may end with a
140 wildcard to apply the values to a whole class of devices.
141 .br
142 If
143 .B udev
144 was built using klibc or is used before the user database is accessible (e.g.
145 .B initrd
146 ), only numeric owner and group values may be used.
147 .sp
148 A sample \fIudev.permissions\fP might look like this:
149 .sp
150 .nf
151 #name:user:group:mode
152 input/*:root:root:644
153 ttyUSB1:0:8:0660
154 video*:root:video:0660
155 dsp1:::0666
156 .fi
157 .SH "FILES"
158 .nf
159 .ft B
160 .ft
161 /sbin/udev                           udev program
162 /etc/udev/*                          udev config and database files
163 /etc/hotplug.d/default/udev.hotplug  hotplug symlink to udev program
164 .fi
165 .LP
166 .SH "SEE ALSO"
167 .BR hotplug (8)
168 .PP
169 The
170 .I http://linux-hotplug.sourceforge.net/
171 web site.
172 .SH AUTHORS
173 .B udev
174 was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
175 Dan Stekloff <dsteklof@us.ibm.com> and many others.