2021-12-27 07:00:00 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
unload () {
|
|
|
|
if modprobe -r "$1" 2>&1;
|
|
|
|
then echo ok
|
|
|
|
else echo fail
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_unload() {
|
|
|
|
while sleep 1; do
|
2022-03-05 07:00:00 -05:00
|
|
|
output="$(unload "$1")"
|
|
|
|
case "$output" in
|
2021-12-27 07:00:00 -05:00
|
|
|
*is\ in\ use*) :;;
|
|
|
|
*ok*) return 0;;
|
2022-03-05 07:00:00 -05:00
|
|
|
*) echo "modprobe said: $output"; echo giving up; return 1;
|
2021-12-27 07:00:00 -05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_unload i2c_hid_acpi
|
|
|
|
wait_unload i2c_hid
|
|
|
|
modprobe i2c_hid
|
|
|
|
modprobe i2c_hid_acpi
|