Skip to content

Commit

Permalink
check for null in response for no Pi Zero 2
Browse files Browse the repository at this point in the history
  • Loading branch information
alanbjohnston authored Mar 2, 2022
1 parent 25beaa2 commit f44a1a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ int main(int argc, char * argv[]) {
const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'";
FILE *file_test = sopen(testStr); // see if Pi Zero 2
fgets(resbuffer, 1000, file_test);
fprintf(stderr, "test result: %s\n", resbuffer);
// fprintf(stderr, "test result: %s\n", resbuffer);
fclose(file_test);

fprintf(stderr, " %x ", resbuffer[0]);
fprintf(stderr, " %x ", resbuffer[1]);
if (resbuffer[0] != 0)
// fprintf(stderr, " %x ", resbuffer[0]);
// fprintf(stderr, " %x ", resbuffer[1]);
if (resbuffer[1] != 0)
{
sleep(5); // try sleep at start to help boot
voltageThreshold = 3.7;
Expand Down

0 comments on commit f44a1a2

Please sign in to comment.