mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-30 06:49:43 +01:00
Merge pull request #437 from symphorien/inspiron-5515
inspiron-5515: fix race for fix-touchpad.sh
This commit is contained in:
commit
727a099e87
2 changed files with 11 additions and 5 deletions
|
@ -12,13 +12,18 @@
|
|||
# hack around it by unloading and reloading module i2c_hid
|
||||
systemd.services.fix-touchpad = {
|
||||
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";
|
||||
# must run at boot (and not too early), and after suspend
|
||||
wantedBy = [ "display-manager.service" "sleep.target" ];
|
||||
after = [ "sleep.target" ];
|
||||
wantedBy = [ "display-manager.service" "post-resume.target" ];
|
||||
# prevent running before suspend
|
||||
after = [ "post-resume.target" ];
|
||||
};
|
||||
|
||||
# so that post-resume.service exists
|
||||
powerManagement.enable = true;
|
||||
|
||||
|
||||
# fix suspend
|
||||
# https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required
|
||||
|
|
|
@ -11,10 +11,11 @@ unload () {
|
|||
|
||||
wait_unload() {
|
||||
while sleep 1; do
|
||||
case "$(unload "$1")" in
|
||||
output="$(unload "$1")"
|
||||
case "$output" in
|
||||
*is\ in\ use*) :;;
|
||||
*ok*) return 0;;
|
||||
*) echo giving up; return 1;
|
||||
*) echo "modprobe said: $output"; echo giving up; return 1;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue