I've found that the logic in get_rpi_info
needs to be updated for Raspberry Pi 4 systems. I've noted this because I'm trying to use gpio in python inside a docker container and it doesn't work if I don't use the privileged flag when creating the container. I'm working to remove privileged from the container I have.
privileged ends up mapping over all of /sys
to the container, which allows get_rpi_info to see /proc/device-tree/system/linux,revision
. If this is used, then the Pi is successfully identified. If privileged is not specified, this interface isn't available and then it tries to use /proc/cpuinfo
for identification, which fails because it hasn't been updated for RPi4s.
There's two changes that need to be made:
/proc/cpuinfo
. "BCM2711
" needs to be allowed as a potential processor option. With that added, it will properly jump into the new scheme handling of the revision.5
mapping to "8G
" will fix that.Jason
I agree I have a 8G rpi and it doesn't show the correct infos :
python -u -c 'import RPi.GPIO as GPIO ; print(GPIO.RPI_INFO)'
tail -n 4 /proc/cpuinfo | grep -v ^Serial
Hardware : BCM2835
Revision : d03114
Model : Raspberry Pi 4 Model B Rev 1.4
and according to https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
d03114 4B 1.4 8GB Sony UK
Merge request sent: https://sourceforge.net/p/raspberry-gpio-python/code/merge-requests/5/
it is missing BCM2711 in cpuinfo.c and this causes an error.
Last edit: Kipjr 2021-01-25
I'm not sure because according to this documentation : https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
Fixed in 0.7.1a4
When will this reach an official repository. And where can I download the patch?
Repo of what distro? Also, the upstream kernel is deprecating GPIO control via sysfs, so you might want to look into alternate Python solutions. This is the new world: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
I use Raspberry Pi OS https://www.raspberrypi.com/software/
Funny, I found that python 2 runs, but not python3
Fixed in 0.7.1