Hi Ben,
I have scripts to import RPI.GPIO module, it used to work fine, then all of sudden it stopped working.
It has the This module can only be run on a Raspberry Pi! error. I look at the code, it seems the cpuinfo has been updated/chagned. Here is my cpuinfo. BCM2711???????
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
Hardware : BCM2711
Revision : c03111
Serial : 1000000091c50795
Model : Raspberry Pi 4 Model B Rev 1.1
What version of RPi.GPIO are you using?
0.7.0
/ # pip show rpi.gpio
Name: RPi.GPIO
Version: 0.7.0
Summary: A module to control Raspberry Pi GPIO channels
Home-page: http://sourceforge.net/projects/raspberry-gpio-python/
Author: Ben Croston
Author-email: ben@croston.org
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:
i did some googling, CPU always been BCM2711, but they didn't update cpuinfo until recently.
What do you get when you:
$ cat /proc/device-tree/system/linux,revision
Also:
$ hexdump /proc/device-tree/system/linux,revision
Which distro are you using? Is it 64 bit?
Sorry, I re-read the code, it seems like it's failing at:
if ((fp = fopen("/proc/device-tree/system/linux,revision", "r"))) {
uint32_t n;
if (fread(&n, sizeof(n), 1, fp) != 1) {
fclose(fp);
return -1;
}
sprintf(revision, "%x", ntohl(n));
found = 1;
}
I am using this inside a docker, /proc/device-tree/ is empty, symlink to sys/firmware is empty.
I wil try map it to see if it works. It used to work fine, not sure what has changed.
Thanks,
Joe
Hosts = Raspbian buster
Docker = alpine
putting the container in privileged mode fixes the issue. Not a clean fix, but will do for now. I will close the ticket. Thx.
I can't close the ticket, only you can lol.