falue / elisas_synchronotron

Driver for Escape room Brainalizer™. [Fake old school CRT animation]
0 stars 0 forks source link

Raspberry pi 4: GPIO "not seem to be available on your platform" #1

Open falue opened 4 months ago

falue commented 4 months ago
/sys/class/gpio/export:Invalid argument
GPIO pin 17 does not seem to be available on your platform
RuntimeException: /sys/class/gpio/export: Invalid argument
RuntimeException: /sys/class/gpio/export: Invalid argument

Related to: https://github.com/benfry/processing4/issues/807

I figure it has something to do with the fact that the rpi3 uses the "Sysfs Interface" for GPIO pins (which is phased out for a long time), and the rpi4 onwards "GPIO Character Device Interface". The Hardware I/O library seems to rely on the "Sysfs Interface"?

The folder /sys/class/gpio on the rpi 4 is almost empty, Output of ls -l /sys/class/gpio is:

xxx@raspberrypi:~ $ ls -l /sys/class/gpio
total 0
--w--w---- 1 root gpio 4096 Apr 23 17:04 export
lrwxrwxrwx 1 root gpio    0 Apr 23 17:04 gpiochip512 -> ../../devices/platform/soc/fe200000.gpio/gpio/gpiochip512
lrwxrwxrwx 1 root gpio    0 Apr 23 17:04 gpiochip570 -> ../../devices/platform/soc/soc:firmware/soc:firmware:gpio/gpio/gpiochip570
--w--w---- 1 root gpio 4096 Apr 23 17:04 unexport

Whereas output of the rpi 3 ls -l /sys/class/gpio is:

xxx@raspberrypi:~ $ ls -l /sys/class/gpio
total 0
--w--w---- 1 root gpio 4096 Apr 23 16:43 export
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio10 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio10
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio11 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio11
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio13 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio13
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio17 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio19 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio19
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio26 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio26
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio27 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio27
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio5 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio5
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio6 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio6
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio9 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio9
lrwxrwxrwx 1 root gpio    0 Apr 23 16:43 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root gpio    0 Apr 23 16:43 gpiochip100 -> ../../devices/gpiochip1/gpio/gpiochip100
lrwxrwxrwx 1 root gpio    0 Apr 23 16:43 gpiochip504 -> ../../devices/platform/soc/soc:firmware/soc:firmware:expgpio/gpio/gpiochip504
--w--w---- 1 root gpio 4096 Apr 23 16:43 unexport
falue commented 4 months ago

https://stackoverflow.com/questions/54376072/how-do-i-enable-the-sysfs-export-gpio-number-from-userspace-support-for-linux/54380957#54380957