i2c_load

来自「Scripts to load and unload i2c driver mo」· 代码 · 共 48 行

TXT
48
字号
#!/bin/shfunction make_minors {    let part=1    while (($part < $minors)); do	let minor=$part+$2	mknod $1$part c $major $minor	let part=$part+1    done}# FIXME: This isn't handling minors (partitions) at all.module="tiny_i2c_adap"device="tiny_i2c_adap"mode="664"chardevice="tiny_i2c_adapr"minors=16# Group: since distributions do it differently, look for wheel or use staffif grep '^staff:' /etc/group > /dev/null; then    group="staff"else    group="wheel"fi# invoke insmod with all arguments we got# and use a pathname, as newer modutils don't look in . by default/sbin/insmod -f ./$module.ko $* || exit 1major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`# Remove stale nodes and replace them, then give gid and permsrm -f /dev/${device}[a-d]* /dev/${device}mknod /dev/${device}a c $major 0make_minors /dev/${device}a 0mknod /dev/${device}b c $major 16make_minors /dev/${device}b 16mknod /dev/${device}c c $major 32make_minors /dev/${device}c 32mknod /dev/${device}d c $major 48make_minors /dev/${device}d 48ln -sf ${device}a /dev/${device}chgrp $group /dev/${device}[a-d]*chmod $mode  /dev/${device}[a-d]*

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?