Skip to content

Commit

Permalink
#3923 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-developer committed Oct 25, 2024
1 parent 66bf822 commit ffc84bc
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3199,19 +3199,28 @@ install_Python()
# Add the status back in.
update_status_from_temp_file

# On pi 5 models we need to replace rpi.gpi with lgpio
# On pi 5 models we need to replace rpi.gpi with lgpio. This should be done by adafruit-blinka
# the code is in setup.py to do this but it doesnt appear to work hence we are forcing it here
# gpiozero decodes the pi revision number to calculate the pi version so until the pi 6 is
# release this code will detect all future versions of the pi 5
#
# NOTE: rpi-gpi and rpi-lgpio cannot co exist but since blinka is not installing either we don't
# currently have to worry about removing rpi-gpio before installing rpi-lgpio
#
pimodel=$(python3 <<EOF
from gpiozero import Device
Device.ensure_pin_factory()
print(Device.pin_factory.board_info.model)
EOF
)

if [[ ${pimodel:0:1} == "5" ]]; then
display_msg --log progress "Updating GPIO to lgpio"
activate_python_venv
pip3 install rpi-lgpio > /dev/null 2>&1
fi
# if we are on the pi 5 then install lgpio, using the virtual environment which will always
# exist on the pi 5
if [[ ${pimodel:0:1} == "5" ]]; then
display_msg --log progress "Updating GPIO to lgpio"
activate_python_venv
pip3 install rpi-lgpio > /dev/null 2>&1
fi

STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" )
}
Expand Down

0 comments on commit ffc84bc

Please sign in to comment.