Skip to content

Commit 79e2d30

Browse files
authored
Merge pull request #282 from erikwelsh/master
Fixed GPIO export problem; Leaves GPIO in bad state on latest BeagleB…
2 parents 8353c7c + e626f07 commit 79e2d30

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

source/event_gpio.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,27 @@ BBIO_err gpio_export(unsigned int gpio)
8585
goto exit;
8686
}
8787

88+
// Is GPIO an LED?
89+
if ( ((gpio >= USR_LED_GPIO_MIN) && (gpio <= USR_LED_GPIO_MAX))
90+
||
91+
( beaglebone_blue()
92+
&&
93+
(
94+
(gpio == USR_LED_RED)
95+
|| (gpio == USR_LED_GREEN)
96+
|| (gpio == BAT25)
97+
|| (gpio == BAT50)
98+
|| (gpio == BAT75)
99+
|| (gpio == BAT100)
100+
|| (gpio == WIFI)
101+
)
102+
)
103+
)
104+
{
105+
syslog(LOG_WARNING, "Adafruit_BBIO: gpio_export: %u not applicable to built-in LEDs", gpio);
106+
return BBIO_OK; // export is not applicable to the USR LED pins
107+
}
108+
88109
// already exported by someone else?
89110
char gpio_path[64];
90111
snprintf(gpio_path, sizeof(gpio_path), "/sys/class/gpio/gpio%d", gpio);

0 commit comments

Comments
 (0)