hybridgroup / gobot

Golang framework for robotics, drones, and the Internet of Things (IoT)
https://gobot.io
Other
8.89k stars 1.04k forks source link

Beaglebone Green: GPIO already exported #685

Open akhudek opened 5 years ago

akhudek commented 5 years ago

On the Beaglebone Green it turns out that GPIO pins start already exported. This causes Gobot to fail on the first run because it can't export the already exported pin. However, once Gobot shuts down, it unexports the pins and subsequently works on being restarted.

This is easy enough to work around by manually unexporting pins on device boot, but it would be nice if Gobot either more gracefully handled this situation or at least provided a way for the user to handle it.

akhudek commented 5 years ago

Actually, this is way more complicated. Turns out the beaglebone exports all the pins by default, and unexport doesn't work, it just errors out. But, if you try to export an already exported pin, it unexports it. Obviously unwanted behaviour.

I have a patch for gobot that checks if the pin is already exported, but it's also more complicated than I thought due to some fixed needed to the gobot testing system. Not sure if it's worth doing a PR for this given it should probably be fixed in the beaglebone firmware.