From 19dafdb9aa3c50dfa9f850eca13c65899b32646e Mon Sep 17 00:00:00 2001
From: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
Date: Wed, 23 Feb 2022 21:21:24 +0100
Subject: [PATCH] use reform-sleep.service instead of /lib/systemd/system-sleep

---
 debian/reform-tools.install |  1 -
 sbin/reform-standby         | 12 ++++++++++++
 systemd/reform-suspend      | 12 ------------
 3 files changed, 12 insertions(+), 13 deletions(-)
 delete mode 100755 systemd/reform-suspend

diff --git a/debian/reform-tools.install b/debian/reform-tools.install
index a2d11a8..ae30c3c 100644
--- a/debian/reform-tools.install
+++ b/debian/reform-tools.install
@@ -8,4 +8,3 @@ etc/*                           /etc
 sbin/*                          /usr/sbin
 systemd/reform-poweroff         /lib/systemd/system-shutdown
 systemd/reform-sleep.conf       /usr/lib/systemd/sleep.conf.d
-systemd/reform-suspend          /lib/systemd/system-sleep
diff --git a/sbin/reform-standby b/sbin/reform-standby
index 3ca3e32..6bb15c4 100755
--- a/sbin/reform-standby
+++ b/sbin/reform-standby
@@ -40,13 +40,25 @@ kbd_backlight_on() {
   done
 }
 
+hid_bind() {
+  echo 0003:03EB:2041.0002 > /sys/bus/hid/drivers/hid-generic/bind
+  echo 0003:03EB:2042.0001 > /sys/bus/hid/drivers/hid-generic/bind
+}
+
+hid_unbind() {
+  echo 0003:03EB:2041.0002 > /sys/bus/hid/drivers/hid-generic/unbind
+  echo 0003:03EB:2042.0001 > /sys/bus/hid/drivers/hid-generic/unbind
+}
+
 if [[ $1 = "suspend" ]]; then
   setup_wake
   wifi_off
   kbd_backlight_off
+  hid_unbind
 fi
 
 if [[ $1 = "resume" ]]; then
   kbd_backlight_on
   wifi_on
+  hid_bind
 fi
diff --git a/systemd/reform-suspend b/systemd/reform-suspend
deleted file mode 100755
index 7e924e4..0000000
--- a/systemd/reform-suspend
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-case "$1" in
-	pre)
-		echo 0003:03EB:2041.0002 >/sys/bus/hid/drivers/hid-generic/unbind
-		echo 0003:03EB:2042.0001 >/sys/bus/hid/drivers/hid-generic/unbind
-		;;
-	post)
-		echo 0003:03EB:2041.0002 >/sys/bus/hid/drivers/hid-generic/bind
-		echo 0003:03EB:2042.0001 >/sys/bus/hid/drivers/hid-generic/bind
-		;;
-esac
-- 
GitLab