mirror of
https://github.com/tbsdtv/media_build.git
synced 2025-07-23 20:30:40 +02:00
52 lines
1005 B
Bash
Executable File
52 lines
1005 B
Bash
Executable File
#!/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
|
|
}
|