Browse Source

Fix /proc/cpuinfo on new Raspberrys without Hardware line

pull/188/head
mstroh76 10 months ago
committed by GitHub
parent
commit
af9f887aa9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      wiringPi/wiringPi.c

+ 4
- 5
wiringPi/wiringPi.c View File

@@ -756,11 +756,11 @@ int piGpioLayout (void)


if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL)
piGpioLayoutOops ("Unable to open /proc/cpuinfo") ; piGpioLayoutOops ("Unable to open /proc/cpuinfo") ;

#ifdef DONT_CARE_ANYMORE
// Start by looking for the Architecture to make sure we're really running // 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 // on a Pi. I'm getting fed-up with people whinging at me because
// they can't get it to work on weirdFruitPi boards... // they can't get it to work on weirdFruitPi boards...

while (fgets (line, 120, cpuFd) != NULL) while (fgets (line, 120, cpuFd) != NULL)
if (strncmp (line, "Hardware", 8) == 0) if (strncmp (line, "Hardware", 8) == 0)
break ; break ;
@@ -779,7 +779,6 @@ int piGpioLayout (void)
// I do not support so don't email me your bleating whinges about anything // I do not support so don't email me your bleating whinges about anything
// other than a genuine Raspberry Pi. // other than a genuine Raspberry Pi.


#ifdef DONT_CARE_ANYMORE
if (! (strstr (line, "BCM2708") || strstr (line, "BCM2709") || strstr (line, "BCM2835"))) if (! (strstr (line, "BCM2708") || strstr (line, "BCM2709") || strstr (line, "BCM2835")))
{ {
fprintf (stderr, "Unable to determine hardware version. I see: %s,\n", line) ; fprintf (stderr, "Unable to determine hardware version. I see: %s,\n", line) ;
@@ -790,7 +789,6 @@ int piGpioLayout (void)
fprintf (stderr, "Raspberry Pi ONLY.\n") ; fprintf (stderr, "Raspberry Pi ONLY.\n") ;
exit (EXIT_FAILURE) ; exit (EXIT_FAILURE) ;
} }
#endif


// Actually... That has caused me more than 10,000 emails so-far. Mosty by // Actually... That has caused me more than 10,000 emails so-far. Mosty by
// people who think they know better by creating a statically linked // people who think they know better by creating a statically linked
@@ -811,7 +809,8 @@ int piGpioLayout (void)
// In-future, I ought to use the device tree as there are now Pi entries in // In-future, I ought to use the device tree as there are now Pi entries in
// /proc/device-tree/ ... // /proc/device-tree/ ...
// but I'll leave that for the next revision. Or the next. // but I'll leave that for the next revision. Or the next.

#endif
// Isolate the Revision line // Isolate the Revision line


rewind (cpuFd) ; rewind (cpuFd) ;


Loading…
Cancel
Save