Open eklitzke opened 5 years ago
Note, rpi-rgb-led-matrix requires to quickly write to GPIO pins, so unless libgpiod allows direct access to writing to the GPIO registers, setting a word of bits in parallel, or a very thin layer around it, it is likely too slow.
Also, the matrix library makes use of other hardware functionality and needs to set registers in the PWM hardware subsystem. Often these addtional hardware abstractions are neglected in abstraction libraries.
So if you want to adapt the library to use such abstraction layer, you need to make sure that the above conditions are met.
You're probably better off configuring your system to allow accessing /dev/mem
Quick glance into the libgpid source reveals that it just uses the /sys/class/gpio character devices. So there would be the kernel abstraction into the character devices and then the libgpiod abstraction on top of that.
The character devices are quite slow and setting multiple lines in sync is a PITA.
Even with CONFIG_STRICT_DEVMEM=n
it does not run on aarch64 (rpi4, arch linux).
I don't see the EPERM error in strace -ff
or anything else suspicious. It just hangs and only kill -9
can make it exit.
Have you considered writing a kernel module or using eBPF to update the GPIO pins?
@cwassert you may want to try this: https://github.com/hzeller/rpi-rgb-led-matrix/issues/812#issuecomment-787527063
I am using a bit of a non-standard setup on my rpi, I'm running Fedora 29 with Linux 4.20 instead of the Raspbian images that most people are using. On Fedora it is not possible to mmap /dev/mem, even as root:
The "right" way to access the GPIO ports is to use libgpiod, uses some sysfs GPIO stuff added to the kernel in Linux 4.8. One nice thing about this is that you can access the GPIO pins this way as a non-privileged user.
I might look into adding ligbpiod support to rpi-rgb-led-matrix myself. I haven't used libpiod so I'm not sure how much work it is to do something like this.