Gpio cleanup in Python
-
Hi there!
I get allways this failure message on my Omega2+: IOError: [Errno 16] Resource busy
Do you have an idea, how to do a Gpio cleanup using Python?
Thanks!
-
I may be wrong but I think you just call
onionGpio._freeGpio()That is what I get from onionGpio.py anyway.
-
Thanks for the hint! You will have to call
gpioObject._freeGpio, then it will work.
-
Hello,
also after calling gpioObject._freeGpio
I still get IOError: [Errno 16] Resource busy
please help
-
I use the official python example, and still get IOError: [Errno 16] Resource busy.
After calling gpioObject._freeGpio, the problem still exists.and I try to use os.system("echo 14>/sys/class/gpio/unexport"), but still fail.
Can anybody help?
-
I really need this to work. Is there any solution to this problem?
-
I'm not near an omega right now so I'm working from memory. I found that I could avoid the resource busy message by using a system call from Python to execute a gpioctl command for control of an output pin. That side-steps the Python library.
-
Ah found a bug in the module code, when setting a GPIO to the output direction, it tries to write
0to that GPIO by calling thesetValuefunction. In turn, this function tries to get sysfs to export the same GPIO again, causing the error (see https://github.com/OnionIoT/onion-gpio-sysfs/blob/master/python/onionGpio.py#L147).We'll put out an update to the package, but in the meantime, this can be fixed locally on your Omega if you have the
pyOnionGpiopackage installed. Open/usr/lib/python2.7/onionGpio.pyand comment out lines 146 and 147 and it will work.
-
I am having this same problem: the solution modifying the onionGpio.py file (commenting out lines 146 and 147) does not work for me... are there other solutions...?
Paul
-
Update: as a final frustrated attempt..., rebooted Omega2+ (reboot from command line), and all is working again... still a mystery as to how to correct this issue without rebooting...
Cheers,
Paul
-
Does onionGpio._freeGpio() free all gpio ports or just one passed the the function?