Browse Source

support bookworm

No Hardware line in /proc/cpuinfo for Bookworm (especially for Raspberry Pi 4 or later), which cause gpio failure.
    Add trying to read model name from /sys/firmware/devicetree/base/model for model name when failed to fetch Hardware line from /proc/cpuinfo
pull/257/head
gcd0318 5 months ago
parent
commit
960fee52bf
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      wiringPi/wiringPiLegacy.c

+ 5
- 1
wiringPi/wiringPiLegacy.c View File

@@ -80,7 +80,11 @@ int piGpioLayoutLegacy (void)
if (strncmp (line, "Hardware", 8) == 0) if (strncmp (line, "Hardware", 8) == 0)
break ; break ;


if (strncmp (line, "Hardware", 8) != 0)
FILE * modelFd;
if ((strncmp (line, "Hardware", 8) != 0) &&
(((modelFd = fopen ("/sys/firmware/devicetree/base/model", "r")) != NULL) ||
(fgets (line, 64, modelFd) != NULL)))
piGpioLayoutOops ("No \"Hardware\" line") ; piGpioLayoutOops ("No \"Hardware\" line") ;


if (wiringPiDebug) if (wiringPiDebug)


Loading…
Cancel
Save