diff --git a/makefile b/makefile index 019636d..98438d8 100644 --- a/makefile +++ b/makefile @@ -9,6 +9,7 @@ else LDFLAGS=-lhidapi-hidraw endif SYSTEMDDIR?=/usr/lib/systemd +SYSTEMD_SLEEP_DIR?=/lib/systemd/system-sleep prefix?=$(DESTDIR)/usr libdir?=$(prefix)/lib @@ -18,7 +19,7 @@ includedir?=$(prefix)/include PROGN=g810-led MAJOR=0 MINOR=2 -MICRO=7 +MICRO=8 CFLAGS+=-DVERSION=\"$(MAJOR).$(MINOR).$(MICRO)\" APPSRCS=src/main.cpp src/helpers/*.cpp src/helpers/*.h @@ -89,6 +90,9 @@ install: setup @test -s /usr/bin/systemd-run && \ systemctl daemon-reload && \ systemctl enable $(PROGN)-reboot + @test -d $(SYSTEMD_SLEEP) && \ + install -m 755 -d $(SYSTEMD_SLEEP_DIR) && \ + install -m 755 systemd/lib/systemd/system-sleep/g810-led.systemd.system-sleep $(SYSTEMD_SLEEP_DIR)/ uninstall-lib: @rm -f $(libdir)/lib$(PROGN).so* @@ -103,6 +107,7 @@ uninstall: systemctl daemon-reload && \ rm -R /etc/$(PROGN) + @rm $(SYSTEMD_SLEEP_DIR)/g810-led.systemd.system-sleep @rm /usr/bin/g213-led @rm /usr/bin/g410-led @rm /usr/bin/g413-led diff --git a/systemd/lib/systemd/system-sleep/g810-led.systemd.system-sleep b/systemd/lib/systemd/system-sleep/g810-led.systemd.system-sleep new file mode 100755 index 0000000..c74b716 --- /dev/null +++ b/systemd/lib/systemd/system-sleep/g810-led.systemd.system-sleep @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +case $1 in + post) + # For now, restart used due to oneshot startup + systemctl restart g810-led + ;; + pre) + # For now, restart used due to oneshot startup + systemctl restart g810-led-reboot + ;; +esac diff --git a/udev/g810-led.rules b/udev/g810-led.rules index d0935f3..b585a5e 100644 --- a/udev/g810-led.rules +++ b/udev/g810-led.rules @@ -1,10 +1,10 @@ -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c336", MODE="666" RUN+="/usr/bin/g213-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", MODE="666" RUN+="/usr/bin/g410-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33a", MODE="666" RUN+="/usr/bin/g413-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c338", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c337", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c32b", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c335", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" -ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c339", MODE="666" RUN+="/usr/bin/gpro-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c336", GROUP="input" RUN+="/usr/bin/g213-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", GROUP="input" RUN+="/usr/bin/g410-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33a", GROUP="input" RUN+="/usr/bin/g413-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", GROUP="input" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c338", GROUP="input" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", GROUP="input" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c337", GROUP="input" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c32b", GROUP="input" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c335", GROUP="input" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c339", GROUP="input" RUN+="/usr/bin/gpro-led -p /etc/g810-led/profile"