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:
[-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args…]
[-]ENVVAR=regexuser:groupmode[=path]∣[>path]∣[!][@∣ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|ENVVAR=regexuser:groupmode[=path]∣[>path]∣[!][@∣|*cmd args…]
[-]@maj,min[-min2] 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=add, $cmd if $ACTION=remove, *cmd in all cases
null may already exist; therefore ownership 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 ownership 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:root 660
ttyUSB[0-9]* root:root 660
alsa sound 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
input stuff
input/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
load modules
MODALIAS=.∗root:root660@modprobe"MODALIAS=.* root:root 660 @modprobe "MODALIAS=.∗root:root660@modprobe"MODALIAS"
block modules
sd[a-z][0-9] root:root 666 @(/etc/hotplug/mount.sh $MDEV $SUBSYSTEM)
sd[a-z] root:root 666 $(/etc/hotplug/umount.sh $MDEV $SUBSYSTEM)
ub[a-z][0-9] root:root 666 @(/etc/hotplug/mount.sh $MDEV $SUBSYSTEM)
ub[a-z] root:root 666 $(/etc/hotplug/umount.sh $MDEV $SUBSYSTEM)
mmcblk[0-9]p[0-9] root:root 666 @(/etc/hotplug/mount.sh $MDEV $SUBSYSTEM)
mmcblk[0-9] root:root 666 $(/etc/hotplug/umount.sh $MDEV $SUBSYSTEM)
当/dev/xxx 被识别后将会出发 脚本执行