1 | #
|
---|
2 | # This is a sample mdev.conf
|
---|
3 | #
|
---|
4 |
|
---|
5 | # Provide user, group, and mode information for devices. If a regex matches
|
---|
6 | # the device name provided by sysfs, use the appropriate user:group and mode
|
---|
7 | # instead of the default 0:0 660.
|
---|
8 | #
|
---|
9 | # Syntax:
|
---|
10 | # [-][ENVVAR=regex;]...devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
---|
11 | # [-][ENVVAR=regex;]...@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
---|
12 | # [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
---|
13 | #
|
---|
14 | # [-]: do not stop on this match, continue reading mdev.conf
|
---|
15 | # =: move, >: move and create a symlink
|
---|
16 | # !: do not create device node
|
---|
17 | # @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
|
---|
18 |
|
---|
19 | # support module loading on hotplug
|
---|
20 | $MODALIAS=.* root:root 660 @modprobe "$MODALIAS"
|
---|
21 |
|
---|
22 | # null may already exist; therefore mode has to be changed with command
|
---|
23 | null root:root 666 @chmod 666 $MDEV
|
---|
24 | zero root:root 666
|
---|
25 | full root:root 666
|
---|
26 | random root:root 444
|
---|
27 | urandom root:root 444
|
---|
28 | hwrandom root:root 444
|
---|
29 | grsec root:root 660
|
---|
30 |
|
---|
31 | kmem root:root 640
|
---|
32 | mem root:root 640
|
---|
33 | port root:root 640
|
---|
34 | # console may already exist; therefore mode has to be changed with command
|
---|
35 | console root:tty 600 @chmod 600 $MDEV
|
---|
36 | ptmx root:tty 666
|
---|
37 | pty.* root:tty 660
|
---|
38 |
|
---|
39 | # Typical devices
|
---|
40 |
|
---|
41 | tty root:tty 666
|
---|
42 | tty[0-9]* root:tty 660
|
---|
43 | vcsa*[0-9]* root:tty 660
|
---|
44 | ttyS[0-9]* root:uucp 660
|
---|
45 |
|
---|
46 | # block devices
|
---|
47 | ram([0-9]*) root:disk 660 >rd/%1
|
---|
48 | loop([0-9]+) root:disk 660 >loop/%1
|
---|
49 | sd[a-z].* root:disk 660 */lib/mdev/usbdisk_link
|
---|
50 | hd[a-z][0-9]* root:disk 660 */lib/mdev/ide_links
|
---|
51 | md[0-9]* root:disk 660
|
---|
52 | sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
|
---|
53 | fd[0-9]* root:floppy 660
|
---|
54 |
|
---|
55 | # net devices
|
---|
56 | SUBSYSTEM=net;.* root:root 600 @nameif
|
---|
57 | tun[0-9]* root:root 600 =net/
|
---|
58 | tap[0-9]* root:root 600 =net/
|
---|
59 |
|
---|
60 | # alsa sound devices and audio stuff
|
---|
61 | pcm.* root:audio 660 =snd/
|
---|
62 | control.* root:audio 660 =snd/
|
---|
63 | midi.* root:audio 660 =snd/
|
---|
64 | seq root:audio 660 =snd/
|
---|
65 | timer root:audio 660 =snd/
|
---|
66 | # for kernels/mdevs which expose full path of alsa devices:
|
---|
67 | snd/pcm.* root:audio 660
|
---|
68 | snd/control.* root:audio 660
|
---|
69 | snd/midi.* root:audio 660
|
---|
70 | snd/seq root:audio 660
|
---|
71 | snd/timer root:audio 660
|
---|
72 |
|
---|
73 | adsp root:audio 660 >sound/
|
---|
74 | audio root:audio 660 >sound/
|
---|
75 | dsp root:audio 660 >sound/
|
---|
76 | mixer root:audio 660 >sound/
|
---|
77 | sequencer.* root:audio 660 >sound/
|
---|
78 |
|
---|
79 | # Less typical devices
|
---|
80 |
|
---|
81 | # raid controllers
|
---|
82 | cciss!(.*) root:disk 660 =cciss/%1
|
---|
83 | ida!(.*) root:disk 660 =ida/%1
|
---|
84 | rd!(.*) root:disk 660 =rd/%1
|
---|
85 |
|
---|
86 | ttyLTM[0-9] root:dialout 660 @ln -sf $MDEV modem
|
---|
87 | ttySHSF[0-9] root:dialout 660 @ln -sf $MDEV modem
|
---|
88 | slamr root:dialout 660 @ln -sf $MDEV slamr0
|
---|
89 | slusb root:dialout 660 @ln -sf $MDEV slusb0
|
---|
90 |
|
---|
91 | fuse root:root 666
|
---|
92 |
|
---|
93 | # dri device
|
---|
94 | card[0-9] root:video 660 =dri/
|
---|
95 |
|
---|
96 | # misc stuff
|
---|
97 | agpgart root:root 660 >misc/
|
---|
98 | psaux root:root 660 >misc/
|
---|
99 | rtc root:root 664 >misc/
|
---|
100 |
|
---|
101 | # input stuff
|
---|
102 | event[0-9]+ root:root 640 =input/
|
---|
103 | mice root:root 640 =input/
|
---|
104 | mouse[0-9] root:root 640 =input/
|
---|
105 | ts[0-9] root:root 600 =input/
|
---|
106 |
|
---|
107 | # v4l stuff
|
---|
108 | vbi[0-9] root:video 660 >v4l/
|
---|
109 | video[0-9] root:video 660 >v4l/
|
---|
110 |
|
---|
111 | # dvb stuff
|
---|
112 | dvb.* root:video 660 */lib/mdev/dvbdev
|
---|
113 |
|
---|
114 | # load drivers for usb devices
|
---|
115 | usbdev[0-9].[0-9] root:root 660 */lib/mdev/usbdev
|
---|
116 | usbdev[0-9].[0-9]_.* root:root 660
|
---|
117 |
|
---|
118 | # zaptel devices
|
---|
119 | zap(.*) root:dialout 660 =zap/%1
|
---|
120 | dahdi!(.*) root:dialout 660 =dahdi/%1
|
---|
121 |
|
---|
122 | # HTC Android
|
---|
123 | # Attaching it via USB cable causes a flurry of activity:
|
---|
124 | #
|
---|
125 | # mdev[1271]: 48.639459 ACTION:add SUBSYSTEM:usb DEVNAME:bus/usb/001/009 DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5
|
---|
126 | # mdev[1271]: mknod bus/usb/001/009 (189,8) 20660 0:0
|
---|
127 | # mdev[1272]: 48.642354 ACTION:add SUBSYSTEM:usb DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0
|
---|
128 | # mdev[1272]: running: modprobe "$MODALIAS"
|
---|
129 | # mdev[1273]: 48.650078 ACTION:add SUBSYSTEM:scsi DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11
|
---|
130 | # mdev[1274]: 48.651297 ACTION:add SUBSYSTEM:scsi_host DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/scsi_host/host11
|
---|
131 | # mdev[1275]: 49.649422 ACTION:add SUBSYSTEM:scsi DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0
|
---|
132 | # mdev[1276]: 49.650703 ACTION:add SUBSYSTEM:scsi DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0
|
---|
133 | # mdev[1276]: running: modprobe "$MODALIAS"
|
---|
134 | # modprobe: module scsi:t-0x00 not found in modules.dep
|
---|
135 | # mdev[1277]: 49.658002 ACTION:add SUBSYSTEM:scsi_disk DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0/scsi_disk/11:0:0:0
|
---|
136 | # mdev[1278]: 49.659244 ACTION:add SUBSYSTEM:scsi_device DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0/scsi_device/11:0:0:
|
---|
137 | # mdev[1279]: 49.660535 ACTION:add SUBSYSTEM:bsg DEVNAME:bsg/11:0:0:0 DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0/bsg/11:0:0:0
|
---|
138 | # mdev[1279]: mknod bsg/11:0:0:0 (253,1) 20660 0:0
|
---|
139 | # mdev[1280]: 49.663516 ACTION:add SUBSYSTEM:bdi DEVNAME:(null) DEVPATH:/devices/virtual/bdi/8:16
|
---|
140 | # mdev[1281]: 49.664748 ACTION:add SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb
|
---|
141 | # mdev[1281]: mknod sdb (8,16) 60660 0:0
|
---|
142 | # mdev[1282]: 49.677597 ACTION:change SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb
|
---|
143 | # mdev[1283]: 50.692936 ACTION:change SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb
|
---|
144 | #
|
---|
145 | # We are hooking to the last events. To avoid having two scripts running,
|
---|
146 | # we check for DISK_MEDIA_CHANGE=1 (prev to last event has it,
|
---|
147 | # and it's the _only_ difference in env for these two events as of kernel 3.7.7)
|
---|
148 | # Unfortunately, there is no event for "user pressed [Turn USB storage on] btn"!
|
---|
149 | # Script merely backgrounds and tries to rescan partition table for 1 minute:
|
---|
150 | ACTION=change;SUBSYSTEM=block;DISK_MEDIA_CHANGE=1;.* 0:0 660 */etc/mdev.conf.change_blockdev.sh
|
---|