inspiron-5515: fix race for fix-touchpad.sh
On rare occasions, the module would be removed before suspend and the touchpad would be disabled on boot.
This commit is contained in:
parent
a7bca8d0d8
commit
fed22c2d60
|
@ -12,13 +12,18 @@
|
||||||
# hack around it by unloading and reloading module i2c_hid
|
# hack around it by unloading and reloading module i2c_hid
|
||||||
systemd.services.fix-touchpad = {
|
systemd.services.fix-touchpad = {
|
||||||
path = [ pkgs.kmod ];
|
path = [ pkgs.kmod ];
|
||||||
serviceConfig.ExecStart = "${./fix_touchpad.sh}";
|
serviceConfig.ExecStart = ''${pkgs.systemd}/bin/systemd-inhibit --what=sleep --why="fixing touchpad must finish before sleep" --mode=delay ${./fix_touchpad.sh}'';
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
description = "reload touchpad driver";
|
description = "reload touchpad driver";
|
||||||
# must run at boot (and not too early), and after suspend
|
# must run at boot (and not too early), and after suspend
|
||||||
wantedBy = [ "display-manager.service" "sleep.target" ];
|
wantedBy = [ "display-manager.service" "post-resume.target" ];
|
||||||
after = [ "sleep.target" ];
|
# prevent running before suspend
|
||||||
|
after = [ "post-resume.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# so that post-resume.service exists
|
||||||
|
powerManagement.enable = true;
|
||||||
|
|
||||||
|
|
||||||
# fix suspend
|
# fix suspend
|
||||||
# https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required
|
# https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required
|
||||||
|
|
|
@ -11,10 +11,11 @@ unload () {
|
||||||
|
|
||||||
wait_unload() {
|
wait_unload() {
|
||||||
while sleep 1; do
|
while sleep 1; do
|
||||||
case "$(unload "$1")" in
|
output="$(unload "$1")"
|
||||||
|
case "$output" in
|
||||||
*is\ in\ use*) :;;
|
*is\ in\ use*) :;;
|
||||||
*ok*) return 0;;
|
*ok*) return 0;;
|
||||||
*) echo giving up; return 1;
|
*) echo "modprobe said: $output"; echo giving up; return 1;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue