sgjava Posted April 28, 2018 Share Posted April 28, 2018 I've been able to use all the other user space I/O without being root. PWM on the other hand seems to create files only after opening device. Is there a udev rule that will work with 4.14 kernel? For all other devices I use a simple rc.local script: chown -R root:gpio /dev/gpiochip0 chmod -R ug+rw /dev/gpiochip0 chown -R root:gpio /dev/gpiochip1 chmod -R ug+rw /dev/gpiochip1 chown -R root:i2c /dev/i2c-0 chmod -R ug+rw /dev/i2c-0 chown -R root:spi /dev/spidev1.0 chmod -R ug+rw /dev/spidev1.0 Link to comment Share on other sites More sharing options...
chrisf Posted April 29, 2018 Share Posted April 29, 2018 Google udev rules Link to comment Share on other sites More sharing options...
sgjava Posted April 29, 2018 Author Share Posted April 29, 2018 Nice, I did that before I asked. See https://github.com/raspberrypi/linux/issues/1983 Link to comment Share on other sites More sharing options...
sgjava Posted April 29, 2018 Author Share Posted April 29, 2018 SUBSYSTEM=="pwm*", PROGRAM="/bin/sh -c '\ chown -R root:gpio /sys/class/pwm && chmod -R 770 /sys/class/pwm;\ chown -R root:gpio /sys/devices/platform/soc/*.pwm/pwm/pwmchip* && chmod -R 770 /sys/devices/platform/soc/*.pwm/pwm/pwmchip*\ '" This seems to set the permissions correctly, but nothing happened (at least no errors) while sudo works fine. I'm using kernel 4.14.18 and it looks like it was merged into the RPi kernel http://lists.infradead.org/pipermail/linux-rpi-kernel/2017-December/007193.html Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 29, 2018 Share Posted April 29, 2018 26 minutes ago, sgjava said: looks like it was merged into the RPi kernel http://lists.infradead.org/pipermail/linux-rpi-kernel/2017-December/007193.html This is mainline, not the RPi kernel, and this commit is present only in 4.16 and newer kernels. Link to comment Share on other sites More sharing options...
sgjava Posted April 30, 2018 Author Share Posted April 30, 2018 OK, thanks. I'll wait for 4.16. Link to comment Share on other sites More sharing options...
sgjava Posted May 3, 2018 Author Share Posted May 3, 2018 I just tested this with Linux NanoPi-Duo 4.16.0-rc6 #239 SMP Wed Apr 11 14:03:49 CST 2018 armv7l armv7l armv7l GNU/Linux using official FriendlyArm image. Just add gpio group, add your non-root user to group and add udev rules /etc/udev/rules.d/99-com.rules I posted above. I tried the Armbian nightly image with 4.16 kernel, but wifi kept dying. Link to comment Share on other sites More sharing options...
Igor Posted May 3, 2018 Share Posted May 3, 2018 3 hours ago, sgjava said: but wifi kept dying. Just a small remark - wifi on Duo ( and on Opi Zero) is famous XR819 which is "half dead" by default Link to comment Share on other sites More sharing options...
sgjava Posted May 3, 2018 Author Share Posted May 3, 2018 @Igor the Ubuntu releases (4.14 kernel currently) have been very solid on the Duo. I have one on my network running 24/7 without any issues for months. This was the nightly Debian release with the 4.16 kernel. The interface comes up for less then a minute then dies. I logged into the serial console and it shows wlan0 unavailable (haven't had time to dig in more). I'll wait for the Ubuntu with 4.16 and test again. I'm just happy I can access all the user space stuff without sudo now that PWM works. Link to comment Share on other sites More sharing options...
Recommended Posts