Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential fix for the Failed to add edge detection error using the latest version of the Raspberry OS ? #387

Open
pbarthelemy opened this issue Jan 18, 2025 · 1 comment

Comments

@pbarthelemy
Copy link

pbarthelemy commented Jan 18, 2025

Hello,

As mentioned in #help on Discord, I ran into the known issue about the failed edge detection, using the latest version of the Raspberry OS installed via the Raspberry imager default.
I used a few google searches with ensuing cut-and-paste my awesome brain power to solve the issue...

I am really not a linux/gpio expert : the steps below worked for me, I can't go beyond that...
Maybe it is a reliable fix/workaround : throwing it to this community for tests and comments !

(Installing an older OS or installing 3 arcane libraries using hard-coded links/versions : not sure which is more satisfying...)

I copied the style of the main doc to document the fix.

happy Inkycaling !
--Philippe

Failed to add edge detection error : using the latest version of the Raspberry OS.

Using the latest version of the Raspberry OS can lead to the "Failed to add edge detection" error when trying to run InkyCal.
(The latest version of the OS is the one you will get by default from the Raspberry Imager application)
This is a known Waveshare library issue, which can not be solved in the InkyCal code itself.
The error will trigger the error message below.

  File "/home/johndoe/Inkycal/venv/lib/python3.11/site-packages/gpiozero/pins/pi.py", line 636, in _set_when_changed
    self._enable_event_detect()
  File "/home/johndoe/Inkycal/venv/lib/python3.11/site-packages/gpiozero/pins/rpigpio.py", line 220, in _enable_event_detect
    GPIO.add_event_detect(
RuntimeError: Failed to add edge detection

What can I do to fix the error ?

installing LGPIO instead of GPIO

If you choose the second option, expect a simple but somewhat lengthy installation.
The steps are detailed below :

# follow the installation procedure up to (included) "pip install RPi.GPIO==0.7.1 spidev==3.5 gpiozero==2.0"
# do execute the pip install above

# first, let's uninstall the GPIO library
 pip uninstall RPi.GPIO

# the other gpio library requires three libraries, let's install them
wget  https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2
bzip2 -d pcre2-10.44.tar.bz2
tar -xf pcre2-10.44.tar
cd pcre2-10.44/
./configure && make && sudo make install && make clean
# grab a coffee... or two ...
cd ..

wget https://sourceforge.net/projects/swig/files/swig/swig-4.3.0/swig-4.3.0.tar.gz
tar zxvf swig-4.3.0.tar.gz
cd swig-4.3.0/
./configure && make && sudo make install && make clean
# enough coffee, go for a walk ...
cd ..

wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
cd lg
make && sudo make install && make clean
cd ..

# and we are ready to install the other GPIO library
cd Inkycal/
pip install rpi-lgpio

# and there we go 
python3 inky_run.py
Copy link

Hi there and welcome to Inkycal. Thanks for opening this issue. As this is your first issue in this repository, please read through the contributing guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant