1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-12-27 12:09:45 +01:00

Merge pull request #437 from symphorien/inspiron-5515

inspiron-5515: fix race for fix-touchpad.sh
This commit is contained in:
Jörg Thalheim 2022-07-31 09:39:25 +01:00 committed by GitHub
commit 727a099e87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -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
}