Hey Yeshu, I found the trouble with WiringPi on Bookworm 32 and 64.
What happens is that the file /proc/cpuinfo in Bookworm is lacking a line that defines "hardware". I found this comparing the same file from a Bullseye install.
My solution is a lazy one, basically am tricking Wiring Pi into reading the bullseye cpuinfo file.
I only tested gpio digital outputs but it is highly likely all other functions will work. Maybe you can test with serial ( I2c or SPI if possible) and report back here.
Here is the procedure:
- Clone WiringPi git as in the previous post.
- Get a copy of bullseye /proc/cpuinfo file, or copy the attached file. It is the same file for Bullseye 32 and 64. Put the file in the pi wherever you feel convenient. I placed it on my home folder.
- make a folder to put the file in a "standard" location, and copy the file there, like so:
sudo mkdir /usr/share/legacywiringpi
sudo cp ~/cpuinfo /usr/share/legacywiringpi/cpuinfo
sudo chmod 444 /usr/share/legacywiringpi/cpuinfo
- Using your preferred editor, open the files "WiringPi/build" and "WiringPi/WiringPi/wiringPi.c" from the cloned repository.
- In both files change any reference to "/proc/cpuinfo" to "/usr/share/legacywiringpi/cpuinfo". On both files there are file open references and echo messages using that string.
- Save both files.
- now you can navigate to your cloned repository folder in a terminal and
./build
It should now be working and installed.
Enter
gpio readall and you should see the gpio table.
You can
/build clean and
/build uninstall to start over if you need to edit the code.
IMPORTANT: This solution is specific for compiling WiringPi on a Raspberry Pi 4.
Let's go to Mars