pikeyd165 – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 // Test program for bcm2835 library
2 // You can only expect this to run correctly
3 // as root on Raspberry Pi hardware, but it will compile and run with little effect
4 // on other hardware
5 //
6 // Author: Mike McCauley
7 // Copyright (C) 2011-2013 Mike McCauley
8 // $Id: test.c,v 1.6 2018/01/16 21:55:07 mikem Exp $
9  
10 #include <bcm2835.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <unistd.h>
14 #include <sys/types.h>
15  
16 int main(int argc, char **argv)
17 {
18 if (geteuid() == 0 && !getenv("FAKEROOTKEY"))
19 {
20 if (!bcm2835_init())
21 return 1;
22 if (!bcm2835_close())
23 return 1;
24 }
25 else
26 {
27 fprintf(stderr, "****You need to be root to properly run this test program\n");
28 return 1;
29 }
30 return 0;
31 }