mirror of https://github.com/joan2937/pigpio
pigpio: allow override of /proc/cpuinfo
This commit is contained in:
parent
c33738a320
commit
9adb7cd1f9
11
pigpio.c
11
pigpio.c
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue