diff options
Diffstat (limited to 'v4l/scripts/modules.sh')
-rw-r--r-- | v4l/scripts/modules.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/v4l/scripts/modules.sh b/v4l/scripts/modules.sh new file mode 100644 index 000000000..8bbc62253 --- /dev/null +++ b/v4l/scripts/modules.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +function xrmmod() { + local module regex + module="$1" + regex=`echo $module | sed -e 's/[-_]/[-_]/g'` + grep -qe "$regex" /proc/modules || return 0 + echo "unload $module" + if test "$UID" = "0"; then + /sbin/rmmod $module + else + sudo /sbin/rmmod $module + fi +} + +function xinsmod() { + local module regex file args + module="$1" + shift + args="$*" + regex=`echo $module | sed -e 's/[-_]/[-_]/g'` + grep -qe "$regex" /proc/modules && return + file="" + test -f "$module.o" && file="$module.o" + test -f "$module.ko" && file="$module.ko" + if test "$file" != ""; then + echo "load $file $args" + if test "$UID" = "0"; then + /sbin/insmod $file $args + else + sudo /sbin/insmod $file $args + fi + else + echo "load $module $args" + if test "$UID" = "0"; then + /sbin/modprobe $module $args + else + sudo /sbin/modprobe $module $args + fi + fi +} + +function v4l2basic() { + for module in i2c-core i2c-algo-bit \ + videodev v4l2-common v4l1-compat \ + video-buf \ + soundcore + do + xinsmod $module + done +} |