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