From 8084b5f7f6bd76e504478553e1a7c4bfbb78a469 Mon Sep 17 00:00:00 2001 From: Aryeh Hillman Date: Wed, 17 Apr 2024 16:42:21 -0700 Subject: [PATCH] Check for sudo in Raspberry/examples/main.c Before: ```sh $ ./epd -2.51 0 /***********************************/ bcm2835 init success !!! Segmentation fault ``` After: ```sh $ sudo ./epd -2.51 0 /***********************************/ bcm2835 init success !!! /***********************************/ VCOM value:2510 Display mode:0 ... ``` --- Raspberry/examples/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Raspberry/examples/main.c b/Raspberry/examples/main.c index 330c9f4..235ad45 100644 --- a/Raspberry/examples/main.c +++ b/Raspberry/examples/main.c @@ -67,6 +67,12 @@ int main(int argc, char *argv[]) //Exception handling:ctrl + c signal(SIGINT, Handler); + if (geteuid() != 0) { + Debug("Please run with root!\r\n"); + Debug("Example: sudo ./epd\r\n"); + exit(1); + } + if (argc < 2){ Debug("Please input VCOM value on FPC cable!\r\n"); Debug("Example: sudo ./epd -2.51\r\n");