ODROID-C5: Use wiringpi in sudo

Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I42bf4afda5a5cb6fc3996c12cb1cb192e58157d6
This commit is contained in:
2025-04-16 17:15:59 +09:00
parent a79270835f
commit 423e0bbcd4

View File

@@ -922,13 +922,6 @@ static void init_gpio_mmap (void)
int fd = -1; int fd = -1;
void *mapped; void *mapped;
/* GPIO mmap setup */
if (!getuid()) {
if ((fd = open ("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0)
msg (MSG_ERR,
"wiringPiSetup: Unable to open /dev/mem: %s\n",
strerror (errno));
} else {
if (access("/dev/gpiomem",0) == 0) { if (access("/dev/gpiomem",0) == 0) {
if ((fd = open ("/dev/gpiomem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0) if ((fd = open ("/dev/gpiomem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0)
msg (MSG_ERR, msg (MSG_ERR,
@@ -938,7 +931,6 @@ static void init_gpio_mmap (void)
} else } else
msg (MSG_ERR, msg (MSG_ERR,
"wiringPiSetup: /dev/gpiomem doesn't exist. Please try again with sudo.\n"); "wiringPiSetup: /dev/gpiomem doesn't exist. Please try again with sudo.\n");
}
if (fd < 0) { if (fd < 0) {
msg(MSG_ERR, "wiringPiSetup: Cannot open memory area for GPIO use. \n"); msg(MSG_ERR, "wiringPiSetup: Cannot open memory area for GPIO use. \n");