changed sxmo-pinephone openrc script to be device-agnostic and invoke a sxmo-setpermissions.sh instead #169
parent
c9eb7e30b7
commit
c51414257e
4 changed files with 36 additions and 7 deletions
@ -1,6 +0,0 @@ |
|||||||
#!/sbin/openrc-run |
|
||||||
|
|
||||||
description="Enable user access to pinephone hardware kernel interface" |
|
||||||
|
|
||||||
command="chmod" |
|
||||||
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/*" |
|
@ -0,0 +1,5 @@ |
|||||||
|
#!/sbin/openrc-run |
||||||
|
|
||||||
|
description="Set user permissions to aspects of the hardware kernel interface" |
||||||
|
|
||||||
|
command="/usr/bin/sxmo_setpermissions.sh" |
@ -0,0 +1,30 @@ |
|||||||
|
#!/usr/bin/env sh |
||||||
|
|
||||||
|
# This script is executed as root |
||||||
|
# from the init process and sets |
||||||
|
# some device-specific permissions |
||||||
|
|
||||||
|
DEVICE="unknown" |
||||||
|
|
||||||
|
#Detecting device |
||||||
|
if [ -e /sys/firmware/devicetree/base ]; then |
||||||
|
if grep -q pinephone compatible; then |
||||||
|
DEVICE="pinephone" |
||||||
|
fi |
||||||
|
fi |
||||||
|
|
||||||
|
pinephone_files="/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" |
||||||
|
|
||||||
|
if [ "$DEVICE" = "pinephone" ]; then |
||||||
|
files="$pinephone_files" |
||||||
|
else |
||||||
|
#guess a few that are hopefully fairly generic: |
||||||
|
files="/sys/power/state /sys/power/mem_sleep /sys/bus/usb/drivers/usb/unbind /sys/bus/usb/drivers/usb/bind /dev/rtc0" |
||||||
|
echo "Warning: SXMO is running on an unknown device, things may not work as expected!">&2 |
||||||
|
fi |
||||||
|
|
||||||
|
for file in $files; do |
||||||
|
[ -e "$file" ] && chmod a+rw "$file" |
||||||
|
done |
||||||
|
|
||||||
|
chmod a+rw /sys/class/wakeup/* |
Loading…
Reference in new issue