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