pigpio: allow override of /proc/cpuinfo

This commit is contained in:
Paul Wallrabe 2021-07-22 10:48:09 +02:00
parent c33738a320
commit 9adb7cd1f9
No known key found for this signature in database
GPG Key ID: CBEC1170D31CBE3B
1 changed files with 13 additions and 8 deletions

View File

@ -13722,10 +13722,16 @@ unsigned gpioHardwareRevision(void)
if (rev) return rev;
filp = fopen ("/proc/cpuinfo", "r");
const char* env_rev_path = getenv("PIGPIO_REVISION_PATH");
if (env_rev_path == NULL)
{
env_rev_path = "/proc/cpuinfo";
}
if (filp != NULL)
filp = fopen (env_rev_path, "r");
if (filp != NULL && rev == 0)
{
while (fgets(buf, sizeof(buf), filp) != NULL)
{
@ -14033,4 +14039,3 @@ int gpioCfgSetInternals(uint32_t cfgVal)
/* include any user customisations */
#include "custom.cext"