Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[sfrench/cifs-2.6.git] / Documentation / media / dvb-drivers / udev.rst
1 .. SPDX-License-Identifier: GPL-2.0
2
3 UDEV rules for DVB
4 ==================
5
6 .. note::
7
8    #) This documentation is outdated. Udev on modern distributions auto-detect
9       the DVB devices.
10
11    #) **TODO:** change this document to explain how to make DVB devices
12       persistent, as, when a machine has multiple devices, they may be detected
13       on different orders, which could cause apps that relies on the device
14       numbers to fail.
15
16 The DVB subsystem currently registers to the sysfs subsystem using the
17 "class_simple" interface.
18
19 This means that only the basic information like module loading parameters
20 are presented through sysfs. Other things that might be interesting are
21 currently **not** available.
22
23 Nevertheless it's now possible to add proper udev rules so that the
24 DVB device nodes are created automatically.
25
26 We assume that you have udev already up and running and that have been
27 creating the DVB device nodes manually up to now due to the missing sysfs
28 support.
29
30 0. Don't forget to disable your current method of creating the
31 device nodes manually.
32
33 1. Unfortunately, you'll need a helper script to transform the kernel
34 sysfs device name into the well known dvb adapter / device naming scheme.
35 The script should be called "dvb.sh" and should be placed into a script
36 dir where udev can execute it, most likely /etc/udev/scripts/
37
38 So, create a new file /etc/udev/scripts/dvb.sh and add the following:
39
40 .. code-block:: none
41
42         #!/bin/sh
43         /bin/echo $1 | /bin/sed -e 's,dvb\([0-9]\)\.\([^0-9]*\)\([0-9]\),dvb/adapter\1/\2\3,'
44
45 Don't forget to make the script executable with "chmod".
46
47 1. You need to create a proper udev rule that will create the device nodes
48 like you know them. All real distributions out there scan the /etc/udev/rules.d
49 directory for rule files. The main udev configuration file /etc/udev/udev.conf
50 will tell you the directory where the rules are, most likely it's /etc/udev/rules.d/
51
52 Create a new rule file in that directory called "dvb.rule" and add the following line:
53
54 .. code-block:: none
55
56         KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c"
57
58 If you want more control over the device nodes (for example a special group membership)
59 have a look at "man udev".
60
61 For every device that registers to the sysfs subsystem with a "dvb" prefix,
62 the helper script /etc/udev/scripts/dvb.sh is invoked, which will then
63 create the proper device node in your /dev/ directory.