From 3a16bf08c0db005728a8cf93c504c565a7f1f7a5 Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Fri, 20 Sep 2024 13:01:54 -0700 Subject: [PATCH] pi5 GPIO packages fix Necessary for blinkatest.py to run without errors on a Pi 5. --- raspi-blinka.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/raspi-blinka.py b/raspi-blinka.py index 620b2e9..c216ab0 100644 --- a/raspi-blinka.py +++ b/raspi-blinka.py @@ -95,6 +95,15 @@ def install_blinka(user=False): shell.run_command(f"{pip_command} RPi.GPIO", run_as_user=username) shell.run_command(f"{pip_command} adafruit-blinka", run_as_user=username) +# Custom function to run additional commands for Pi 5 +def check_and_install_for_pi5(pi_model): + if pi_model.startswith("RASPBERRY_PI_5"): + print("Detected Raspberry Pi 5, applying additional fixes...") + os.system("sudo apt remove python3-rpi.gpio") + os.system("pip3 install rpi-lgpio") + else: + print(f"Detected {pi_model}, no additional fixes needed.") + def main(): global default_python shell.clear() @@ -130,6 +139,9 @@ Raspberry Pi and installs Blinka update_pip() install_blinka(True) + # Check and install for Pi 5 if detected + check_and_install_for_pi5(pi_model) + # Done print("""DONE.