最近更新于 2024-09-17 00:35
硬件:树莓派 CM4
系统:raspios 20240704 Debian 12 arm64(Linux Kernal 6.6.31+rpt-rpi-v8)
WiringPi:3.10
正确地安装步骤参考:
1.安装构建工具
sudo apt update
sudo apt install -y build-essential git
2.克隆源码
git clone https://github.com/WiringPi/WiringPi.git --depth=1 --branch=3.10
cd WiringPi
3.修改源码
这部分是增加的内容,也是解决标题报错的关键(来源参考:https://raspberrypi.stackexchange.com/questions/145031/wiringpi-giving-unable-to-determine-board-revision-from-proc-cpuinfo-error-af )
整体复制粘粘执行
cat <<'PATCH' | patch --ignore-whitespace -p1 wiringPi/wiringPi.c
@@ -747,6 +747,7 @@ int piGpioLayout (void)
if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL)
piGpioLayoutOops ("Unable to open /proc/cpuinfo") ;
+#ifdef DONT_CARE_ANYMORE
// Start by looking for the Architecture to make sure we're really running
// on a Pi. I'm getting fed-up with people whinging at me because
// they can't get it to work on weirdFruitPi boards...
@@ -769,7 +770,6 @@ int piGpioLayout (void)
// I do not support so don't email me your bleating whinges about anything
// other than a genuine Raspberry Pi.
-#ifdef DONT_CARE_ANYMORE
if (! (strstr (line, "BCM2708") || strstr (line, "BCM2709") || strstr (line, "BCM2835")))
{
fprintf (stderr, "Unable to determine hardware version. I see: %s,\n", line) ;
PATCH
4.构建安装
bash INSTALL
5.测试
版本查看
gpio -v
接口查看
gpio readall
树莓派使用 WiringPi 报错 Unable to determine board revision from /proc/cpuinfo