etc: rename script more generic.

Signed-off-by: Steve Jeong <how2soft@gmail.com>
Change-Id: Ia3cdc818a9156a4aaad346e63efdea6e32ab864b
This commit is contained in:
Steve Jeong
2023-04-20 10:09:48 +09:00
parent 84e3f6d04d
commit df2e302ebe
9 changed files with 15 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := odroid-wpi-pwm.sh
LOCAL_MODULE := odroid-allowuser.sh
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)

View File

@@ -5,7 +5,7 @@ set -e
case "$1" in
purge)
rm -f /etc/udev/rules.d/99-odroid-wiringpi-*
rm -f /etc/odroid-wpi-pwm.sh
rm -f /etc/odroid-allowuser.sh
rm -f /etc/sudoers.d/odroid-wpi-sudoers
;;

View File

@@ -1,11 +1,10 @@
#!/bin/sh
# /etc/odroid-wpi-pwm.sh
# /etc/odroid-allowuser.sh
# written by Steve Jeong <how2soft@gmail.com>
#
# allow access pwm sys node (with odroid-wiringpi gpiomem).
# udev rules: 99-odroid-wiringpi-pwm.rules
# param: "/sys/class/pwm/pwmchip*" default.
# allow access sys node (with odroid-wiringpi gpiomem).
# udev rules: 99-odroid-wiringpi-*.rules
cutoff=0

View File

@@ -1,2 +1,2 @@
# Allow members of the odroid group change permission of wpi
%odroid ALL = (ALL) NOPASSWD: /usr/bin/sh /etc/odroid-wpi-pwm.sh*
%odroid ALL = (ALL) NOPASSWD: /usr/bin/sh /etc/odroid-allowuser.sh*

View File

@@ -1 +1 @@
ACTION=="add", KERNEL=="pwmchip*", SUBSYSTEM=="pwm", RUN+="/bin/sh /etc/odroid-wpi-pwm.sh /sys/class/pwm/pwmchip*"
ACTION=="add", KERNEL=="pwmchip*", SUBSYSTEM=="pwm", RUN+="/bin/sh /etc/odroid-allowuser.sh /sys/class/pwm/pwmchip*"

View File

@@ -427,9 +427,9 @@ static int pwmSetup (int pin) {
sprintf(pwmPinPath[pwmPin], "%s/pwm%d", sysPwmPath, (pwmPin % 2));
strncpy(setupedPwmPinPath[pwmPin], pwmPinPath[pwmPin], (BLOCK_SIZE - 1));
#ifdef ANDROID
sprintf(cmd, "su -s sh -c %s %s", PWM_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
sprintf(cmd, "su -s sh -c %s %s", SYS_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
#else
sprintf(cmd, "sudo sh %s %s", PWM_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
sprintf(cmd, "sudo sh %s %s", SYS_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
#endif
inputToSysNode(sysPwmPath, "export", pwmExport);
system(cmd);

View File

@@ -340,9 +340,9 @@ static int pwmSetup (int pin) {
sprintf(pwmPinPath[pwmPin], "%s/pwm%d", sysPwmPath, 0);
strncpy(setupedPwmPinPath[pwmPin], pwmPinPath[pwmPin], (BLOCK_SIZE - 1));
#ifdef ANDROID
sprintf(cmd, "su -s sh -c %s %s", PWM_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
sprintf(cmd, "su -s sh -c %s %s", SYS_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
#else
sprintf(cmd, "sudo sh %s %s", PWM_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
sprintf(cmd, "sudo sh %s %s", SYS_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
#endif
inputToSysNode(sysPwmPath, "export", pwmExport);
system(cmd);

View File

@@ -412,9 +412,9 @@ static int pwmSetup (int pin) {
sprintf(pwmPinPath[pwmPin], "%s/pwm%d", sysPwmPath, (pwmPin % 2));
strncpy(setupedPwmPinPath[pwmPin], pwmPinPath[pwmPin], (BLOCK_SIZE - 1));
#ifdef ANDROID
sprintf(cmd, "su -s sh -c %s %s", PWM_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
sprintf(cmd, "su -s sh -c %s %s", SYS_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
#else
sprintf(cmd, "sudo sh %s %s", PWM_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
sprintf(cmd, "sudo sh %s %s", SYS_ACCESS_SCRIPT, pwmPinPath[pwmPin]);
#endif
inputToSysNode(sysPwmPath, "export", pwmExport);
system(cmd);

View File

@@ -102,8 +102,8 @@
// Module names
#define AML_MODULE_I2C "aml_i2c"
// syspwm
#define PWM_ACCESS_SCRIPT "/etc/odroid-wpi-pwm.sh"
// sysnode
#define SYS_ACCESS_SCRIPT "/etc/odroid-allowuser.sh"
// Threads
#define PI_THREAD(X) void *X (UNU void *dummy)