0

The 4.9.78-ti-r94 distro comes with 81-pwm-nonroot.rules

# /etc/udev/rules.d/81-pwm-noroot.rules
#
# Corrects sys PWM permissions on the BB so non-root users in the gpio group can manipulate bits
#
SUBSYSTEM=="pwm", ACTION=="add", PROGRAM="/bin/sh -c '/bin/chown -R root:pwm /sys/class/pwm/"
SUBSYSTEM=="pwm", ACTION=="add", PROGRAM="/bin/sh -c    '/bin/chmod -R ug+rw /sys/class/pwm/"

SUBSYSTEM=="pwm", ACTION=="add", PROGRAM="/bin/sh -c '/bin/chown -R root:pwm /sys/class/pwm/pwmchip*/'"
SUBSYSTEM=="pwm", ACTION=="add", PROGRAM="/bin/sh -c    '/bin/chmod -R ug+rw /sys/class/pwm/pwmchip*/'"

Anyway, seems that it does not work. rwxr-xr-x 3 root root 0 Oct 11 03:17 pwm1 IS ROOT:ROOT

lrwxrwxrwx 1 root pwm    0 Oct 11 02:32 device -> ../../../48304200.pwm
-rw-rw---- 1 root pwm 4096 Oct 11 03:14 export
-rw-rw-r-- 1 root pwm 4096 Oct 11 02:31 npwm
drwxrwxr-x 2 root pwm    0 Oct 11 02:31 power
lrwxrwxrwx 1 root pwm    0 Oct 11 02:32 subsystem -> ../../../../../../../class/pwm
-rw-rw-r-- 1 root pwm 4096 Oct 11 02:31 uevent
-rw-rw---- 1 root pwm 4096 Oct 11 03:17 unexport

root@s2w10l:/sys/class/pwm/pwmchip6# echo 1 > export 

total 0
lrwxrwxrwx 1 root pwm     0 Oct 11 02:32 device -> ../../../48304200.pwm
-rw-rw---- 1 root pwm  4096 Oct 11 03:17 export
-rw-rw-r-- 1 root pwm  4096 Oct 11 02:31 npwm
drwxrwxr-x 2 root pwm     0 Oct 11 02:31 power
drwxr-xr-x 3 root root    0 Oct 11 03:17 pwm1<<<  IS ROOT  ROOT <<<<<<<<<?!?!?!?!?!
lrwxrwxrwx 1 root pwm     0 Oct 11 02:32 subsystem -> ../../../../../../../class/pwm
-rw-rw-r-- 1 root pwm  4096 Oct 11 02:31 uevent
-rw-rw---- 1 root pwm  4096 Oct 11 03:17 unexport
0

I had to add 90-rules as

SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;'"
SUBSYSTEM=="pwm*", PROGRAM="/bin/sh -c 'chown -R root:pwm /sys/class/pwm/* && chmod -R 770 /sys/class/pwm/*;'"

and indeed solved the issue for gpio because udev senses the gpio export

# on a second temrinal monitor the udev
udevadm monitor
...
KERNEL - the kernel uevent

KERNEL[46318.324637] add      /devices/platform/ocp/44e07000.gpio/gpiochip0/gpio/gpio24 (gpio)
UDEV  [46318.648582] add      /devices/platform/ocp/44e07000.gpio/gpiochip0/gpio/gpio24 (gpio)

but for PWM it does not

echo 0 > /sys/class/pwm/pwmchip6/export

# on the second terminal 
udevadm monitor  # remains silent

Any help would be appreciated. Thank you

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.