a03195941b
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
151 lines
5.7 KiB
Plaintext
151 lines
5.7 KiB
Plaintext
#
|
|
# This is a sample mdev.conf
|
|
#
|
|
|
|
# Provide user, group, and mode information for devices. If a regex matches
|
|
# the device name provided by sysfs, use the appropriate user:group and mode
|
|
# instead of the default 0:0 660.
|
|
#
|
|
# Syntax:
|
|
# [-][ENVVAR=regex;]...devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
|
# [-][ENVVAR=regex;]...@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
|
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
|
#
|
|
# [-]: do not stop on this match, continue reading mdev.conf
|
|
# =: move, >: move and create a symlink
|
|
# !: do not create device node
|
|
# @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
|
|
|
|
# support module loading on hotplug
|
|
$MODALIAS=.* root:root 660 @modprobe "$MODALIAS"
|
|
|
|
# null may already exist; therefore mode has to be changed with command
|
|
null root:root 666 @chmod 666 $MDEV
|
|
zero root:root 666
|
|
full root:root 666
|
|
random root:root 444
|
|
urandom root:root 444
|
|
hwrandom root:root 444
|
|
grsec root:root 660
|
|
|
|
kmem root:root 640
|
|
mem root:root 640
|
|
port root:root 640
|
|
# console may already exist; therefore mode has to be changed with command
|
|
console root:tty 600 @chmod 600 $MDEV
|
|
ptmx root:tty 666
|
|
pty.* root:tty 660
|
|
|
|
# Typical devices
|
|
|
|
tty root:tty 666
|
|
tty[0-9]* root:tty 660
|
|
vcsa*[0-9]* root:tty 660
|
|
ttyS[0-9]* root:uucp 660
|
|
|
|
# block devices
|
|
ram([0-9]*) root:disk 660 >rd/%1
|
|
loop([0-9]+) root:disk 660 >loop/%1
|
|
sd[a-z].* root:disk 660 */lib/mdev/usbdisk_link
|
|
hd[a-z][0-9]* root:disk 660 */lib/mdev/ide_links
|
|
md[0-9]* root:disk 660
|
|
sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
|
|
fd[0-9]* root:floppy 660
|
|
|
|
# net devices
|
|
SUBSYSTEM=net;.* root:root 600 @nameif
|
|
tun[0-9]* root:root 600 =net/
|
|
tap[0-9]* root:root 600 =net/
|
|
|
|
# alsa sound devices and audio stuff
|
|
pcm.* root:audio 660 =snd/
|
|
control.* root:audio 660 =snd/
|
|
midi.* root:audio 660 =snd/
|
|
seq root:audio 660 =snd/
|
|
timer root:audio 660 =snd/
|
|
# for kernels/mdevs which expose full path of alsa devices:
|
|
snd/pcm.* root:audio 660
|
|
snd/control.* root:audio 660
|
|
snd/midi.* root:audio 660
|
|
snd/seq root:audio 660
|
|
snd/timer root:audio 660
|
|
|
|
adsp root:audio 660 >sound/
|
|
audio root:audio 660 >sound/
|
|
dsp root:audio 660 >sound/
|
|
mixer root:audio 660 >sound/
|
|
sequencer.* root:audio 660 >sound/
|
|
|
|
# Less typical devices
|
|
|
|
# raid controllers
|
|
cciss!(.*) root:disk 660 =cciss/%1
|
|
ida!(.*) root:disk 660 =ida/%1
|
|
rd!(.*) root:disk 660 =rd/%1
|
|
|
|
ttyLTM[0-9] root:dialout 660 @ln -sf $MDEV modem
|
|
ttySHSF[0-9] root:dialout 660 @ln -sf $MDEV modem
|
|
slamr root:dialout 660 @ln -sf $MDEV slamr0
|
|
slusb root:dialout 660 @ln -sf $MDEV slusb0
|
|
|
|
fuse root:root 666
|
|
|
|
# dri device
|
|
card[0-9] root:video 660 =dri/
|
|
|
|
# misc stuff
|
|
agpgart root:root 660 >misc/
|
|
psaux root:root 660 >misc/
|
|
rtc root:root 664 >misc/
|
|
|
|
# input stuff
|
|
event[0-9]+ root:root 640 =input/
|
|
mice root:root 640 =input/
|
|
mouse[0-9] root:root 640 =input/
|
|
ts[0-9] root:root 600 =input/
|
|
|
|
# v4l stuff
|
|
vbi[0-9] root:video 660 >v4l/
|
|
video[0-9] root:video 660 >v4l/
|
|
|
|
# dvb stuff
|
|
dvb.* root:video 660 */lib/mdev/dvbdev
|
|
|
|
# load drivers for usb devices
|
|
usbdev[0-9].[0-9] root:root 660 */lib/mdev/usbdev
|
|
usbdev[0-9].[0-9]_.* root:root 660
|
|
|
|
# zaptel devices
|
|
zap(.*) root:dialout 660 =zap/%1
|
|
dahdi!(.*) root:dialout 660 =dahdi/%1
|
|
|
|
# HTC Android
|
|
# Attaching it via USB cable causes a flurry of activity:
|
|
#
|
|
# mdev[1271]: 48.639459 ACTION:add SUBSYSTEM:usb DEVNAME:bus/usb/001/009 DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5
|
|
# mdev[1271]: mknod bus/usb/001/009 (189,8) 20660 0:0
|
|
# 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
|
|
# mdev[1272]: running: modprobe "$MODALIAS"
|
|
# 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
|
|
# 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
|
|
# 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
|
|
# 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
|
|
# mdev[1276]: running: modprobe "$MODALIAS"
|
|
# modprobe: module scsi:t-0x00 not found in modules.dep
|
|
# 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
|
|
# 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:
|
|
# 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
|
|
# mdev[1279]: mknod bsg/11:0:0:0 (253,1) 20660 0:0
|
|
# mdev[1280]: 49.663516 ACTION:add SUBSYSTEM:bdi DEVNAME:(null) DEVPATH:/devices/virtual/bdi/8:16
|
|
# mdev[1281]: 49.664748 ACTION:add SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb
|
|
# mdev[1281]: mknod sdb (8,16) 60660 0:0
|
|
# mdev[1282]: 49.677597 ACTION:change SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb
|
|
# mdev[1283]: 50.692936 ACTION:change SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb
|
|
#
|
|
# We are hooking to the last events. To avoid having two scripts running,
|
|
# we check for DISK_MEDIA_CHANGE=1 (prev to last event has it,
|
|
# and it's the _only_ difference in env for these two events as of kernel 3.7.7)
|
|
# Unfortunately, there is no event for "user pressed [Turn USB storage on] btn"!
|
|
# Script merely backgrounds and tries to rescan partition table for 1 minute:
|
|
ACTION=change;SUBSYSTEM=block;DISK_MEDIA_CHANGE=1;.* 0:0 660 */etc/mdev.conf.change_blockdev.sh
|