热插拔 mdev hotplug

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 被识别后将会出发 脚本执行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值