安卓系统,/sys/class/pwm/目录下的节点需要使用root用户进行读写。写应用程序时没有可读写权限。可以使用如下方法修改其初始状态的可执行权限。 以pwm0和pwm2为例,在device/rockchip/common/rootdir/init.rk30board.rc文件中添加如下指令: write /sys/class/pwm/pwmchip0/export 0 chown system system /sys/class/pwm/pwmchip0/pwm0/enable chown system system /sys/class/pwm/pwmchip0/pwm0/polarity chown system system /sys/class/pwm/pwmchip0/pwm0/period chown system system /sys/class/pwm/pwmchip0/pwm0/duty_cycle chmod 0666 /sys/class/pwm/pwmchip0/pwm0/enable chmod 0666 /sys/class/pwm/pwmchip0/pwm0/polarity chmod 0666 /sys/class/pwm/pwmchip0/pwm0/period chmod 0666 /sys/class/pwm/pwmchip0/pwm0/duty_cycle write /sys/class/pwm/pwmchip2/export 0 chown system system /sys/class/pwm/pwmchip2/pwm0/enable chown system system /sys/class/pwm/pwmchip2/pwm0/polarity chown system system /sys/class/pwm/pwmchip2/pwm0/period chown system system /sys/class/pwm/pwmchip2/pwm0/duty_cycle chmod 0666 /sys/class/pwm/pwmchip2/pwm0/enable chmod 0666 /sys/class/pwm/pwmchip2/pwm0/polarity chmod 0666 /sys/class/pwm/pwmchip2/pwm0/period chmod 0666 /sys/class/pwm/pwmchip2/pwm0/duty_cycle |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-22 11:24
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.