From 871964da4e5782a09347771cf9875705fd9a162d Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Tue, 2 Mar 2021 22:20:50 +0100 Subject: [PATCH] Use udev for chmod device access Tested on postmarketOS and Debian. Need to change filename so all rules are applied. Signed-off-by: Anjandev Momi --- configs/openrc/sxmo-pinephone | 2 +- configs/udev/50-sxmo.rules | 2 -- configs/udev/90-sxmo.rules | 11 +++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) delete mode 100644 configs/udev/50-sxmo.rules create mode 100644 configs/udev/90-sxmo.rules diff --git a/configs/openrc/sxmo-pinephone b/configs/openrc/sxmo-pinephone index 77fb51e..f6d68f3 100644 --- a/configs/openrc/sxmo-pinephone +++ b/configs/openrc/sxmo-pinephone @@ -3,4 +3,4 @@ description="Enable user access to pinephone hardware kernel interface" command="chmod" -command_args="a+rw /sys/module/8723cs/parameters/rtw_scan_interval_thr /sys/devices/platform/backlight/backlight/backlight/brightness /sys/power/state /sys/devices/platform/soc/1f00000.rtc/power/wakeup /sys/power/mem_sleep /sys/bus/usb/drivers/usb/unbind /sys/bus/usb/drivers/usb/bind /sys/class/leds/red:indicator/brightness /sys/class/leds/blue:indicator/brightness /sys/class/leds/green:indicator/brightness /sys/class/leds/white:flash/brightness /dev/rtc0 /sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/power/wakeup /sys/class/wakeup/*" +command_args="a+rw /sys/module/8723cs/parameters/rtw_scan_interval_thr /sys/power/state /sys/devices/platform/soc/1f00000.rtc/power/wakeup /sys/power/mem_sleep /sys/bus/usb/drivers/usb/unbind /sys/bus/usb/drivers/usb/bind /dev/rtc0 /sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/power/wakeup /sys/class/wakeup/*" diff --git a/configs/udev/50-sxmo.rules b/configs/udev/50-sxmo.rules deleted file mode 100644 index 9b4455a..0000000 --- a/configs/udev/50-sxmo.rules +++ /dev/null @@ -1,2 +0,0 @@ -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/sxmo_statusbarupdate.sh" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/sxmo_statusbarupdate.sh" diff --git a/configs/udev/90-sxmo.rules b/configs/udev/90-sxmo.rules new file mode 100644 index 0000000..c294e26 --- /dev/null +++ b/configs/udev/90-sxmo.rules @@ -0,0 +1,11 @@ +SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/sxmo_statusbarupdate.sh" +SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/sxmo_statusbarupdate.sh" + +ACTION=="add", SUBSYSTEM=="input", ENV{ID_INPUT_TOUCHSCREEN}=="1", MODE:="0666", SYMLINK+="input/touchscreen" +ACTION=="add", SUBSYSTEM=="input", ENV{ID_PATH}=="platform-vibrator", MODE:="0666" + +# taken from https://github.com/haikarainen/light/blob/master/90-backlight.rules +ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness" +ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness" +ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp video /sys/class/leds/%k/brightness" +ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"