Open daguej opened 4 years ago
Thanks for the detailed report.
It looks like at the very least, it's a bug that it assumes the value of /proc/cpuinfo
. It shouldn't break. At the moment I'm thinking that a patch to ensure it doesn't break, and to default to the v2 schema when it couldn't find the info, would be a good basic fix.
Reading /proc/device-tree
could then be a second phase enhancement. I'm just wondering if it's worth doing given that it looks like that version of Ubuntu only supports Pi 2 and above anyway, which would all use the v2 schema. I'm not very familiar with these alternative OS's for the Pi, so am a bit unsure whether this functionality would be useful, and whether Device Tree would always be available anyway.
Using this module on a Pi running a 64-bit Linux distro (eg Ubuntu 18.04 arm64) errors out when you call
setup()
.(thrown here)
This happens because
/proc/cpuinfo
does not contain the expectedRevision: …
line under 64-bit Linux.To test, I followed this advice, bind-mounting a fake cpuinfo file on
/proc/cpuinfo
and addingRevision: a02082
. With this, the rpi-gpio library started working.It appears the correct place to look on a 64-bit system is
/proc/device-tree/system/linux,revision
.(unsure if 32-bit systems have the same thing)