4.9.78-ti-r94 배포판에는 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*/'"
어쨌든 작동하지 않는 것 같습니다. rwxr-xr-x 3 루트 루트 0 10월 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
답변1
90개의 규칙을 추가해야 합니다.
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/*;'"
그리고 udev는 GPIO 내보내기를 알고 있기 때문에 GPIO 문제를 해결합니다.
# 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)
하지만 PWM의 경우에는 그렇지 않습니다.
echo 0 > /sys/class/pwm/pwmchip6/export
# on the second terminal
udevadm monitor # remains silent
어떤 도움이라도 대단히 감사하겠습니다. 감사해요