1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2025-04-04 15:21:45 +00:00

Added systemd sleep/resume hack, udev groups, and makefile updates.

This commit is contained in:
Maulik Mistry 2018-02-20 02:11:36 -07:00
parent 1b480ae4c2
commit 580c8494c5
3 changed files with 29 additions and 11 deletions

View File

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

View File

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

View File

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