From e626f07d8d79e3eca8a2578da7eab6e8096b0e29 Mon Sep 17 00:00:00 2001 From: Erik Welsh Date: Sun, 30 Sep 2018 16:20:04 +0000 Subject: [PATCH] Fixed GPIO export problem; Leaves GPIO in bad state on latest BeagleBone image on PocketBeagle --- source/event_gpio.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/event_gpio.c b/source/event_gpio.c index c63fdbd..9f5acd6 100644 --- a/source/event_gpio.c +++ b/source/event_gpio.c @@ -85,6 +85,27 @@ BBIO_err gpio_export(unsigned int gpio) goto exit; } + // Is GPIO an LED? + if ( ((gpio >= USR_LED_GPIO_MIN) && (gpio <= USR_LED_GPIO_MAX)) + || + ( beaglebone_blue() + && + ( + (gpio == USR_LED_RED) + || (gpio == USR_LED_GREEN) + || (gpio == BAT25) + || (gpio == BAT50) + || (gpio == BAT75) + || (gpio == BAT100) + || (gpio == WIFI) + ) + ) + ) + { + syslog(LOG_WARNING, "Adafruit_BBIO: gpio_export: %u not applicable to built-in LEDs", gpio); + return BBIO_OK; // export is not applicable to the USR LED pins + } + // already exported by someone else? char gpio_path[64]; snprintf(gpio_path, sizeof(gpio_path), "/sys/class/gpio/gpio%d", gpio);