GPIO.add_event_detect gives runtime error
A Python module to control the GPIO on a Raspberry Pi
Brought to you by:
croston
Hi Ben,
I don't know whether you're aware of this, but it seems that when running in non-sudo mode RPi.GPIO frequently gives RuntimeError: Failed to add edge detection. It doesn't happen if you sudo the python script and it seems to be common to both python2 and python3. Seems to be with the latest versions of Raspbian Jessie on BCM2835 platforms, not seen it yet on a Pi2. If there's anything else you need to know, let me know.
Cheers, Neil
This is caused by the time udev takes to change the permissions/owenership on /sys/class/gpio/ files for unprivileged users. At the moment, there is an arbitury delay of 50ms to wait for this to happen - this does not seem to be the right approach.
Just encountered this error - my experience is that it works then fails then works then fails etc. Works 100% of the time when running as root. I tryied putting a delay of 100ms between initialisation and invoking add_event_detect but still get the error every other invocation.
Fix is in source code library (available for testing by manually installing development version). Will be in next release.
Thanks, Ben & Happy New Year.
On 01/01/2016 18:03, Ben Croston wrote:
--
Neil Matthews in Impington, Cambridge, UK
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Related
Tickets:
#118Hi Ben,
Any idea how long before it appears in the archives? Apt-get update &
apt-get upgrade still says that 0.6.0a3 is the latest.
Cheers,
Neil
On 03/01/2016 15:54, Ben Croston wrote:
--
Neil Matthews in Impington, Cambridge, UK
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Related
Tickets:
#118Neil,
I haven't got a clue when it will be available in the archives. I asked the Foundation to update it at 6pm (ish) last night. In the past, I have known as fast as a 1 hour turnaround and as slow as a 1 week turnaround. You can always pester them on Twitter!