Skip to content

Instantly share code, notes, and snippets.

@SwagDevOps
Created June 15, 2022 06:11
Show Gist options
  • Save SwagDevOps/e1d580ca0334a345d0e86a30285a0fdd to your computer and use it in GitHub Desktop.
Save SwagDevOps/e1d580ca0334a345d0e86a30285a0fdd to your computer and use it in GitHub Desktop.
Touchpad not working after suspending laptop (MaxBook Y13 Pro - BMAX)
#!/usr/bin/env sh
# @file /lib/systemd/system-sleep/touchpad
# @see https://askubuntu.com/questions/671910/touchpad-not-working-after-suspending-laptop
set -eu
# constants ----------------------------------------------------------
MODULES="i2c_hid_acpi"
RETCODE=0
# functions ----------------------------------------------------------
reload() {
for module in $@; do
/usr/sbin/lsmod | grep -Eq "^${module}\s+" ||:
/sbin/modprobe -srv "$module" || {
RETCODE=1
continue
}
/sbin/modprobe -sv "$module"
done
}
# execution ----------------------------------------------------------
case "${1:-}" in
post)
reload $MODULES
;;
esac
exit $RETCODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment