Fixing MightyHat shutdown/reboot functionality on RPi OS Lite 2024-03 (bookworm)

Started by Stereodude, June 21, 2024, 04:43:32 PM

Stereodude

Neither method from the PiGateway install script works with the ARMHF (non 64-bit) Raspberry Pi OS Lite version 2024-03 (bookworm). I diagnosed the recommended .py script version. It seems that it doesn't work because the Python library for GPIO included with this version of the OS has either deprecated or broken support for the GPIO.wait_for_edge command that the script uses. As of now there is no newer release for it. The fix is to replace the GPIO python libary with the LGPIO python library and modify the script to use it.

The commands to do this are:
sudo apt remove python3-rpi.gpio
sudo apt autoremove
sudo apt update
sudo apt install python3-rpi-lgpio

Then change the 4th line of the script as shown below:

sudo nano /etc/shutdownirq.py

old: import RPi.GPIO as GPIO
new: from RPi import GPIO


nodnarb

Thank you so much, I tried everything I could think of and was literally JUST about to try re-flashing my SD card with a new version of Raspberry Pi OS. Good thing I thought to search "OS" on this forum, because your solution worked instantly.

I'm using the Raspberry Pi OS 64-bit version so I wonder if this is an issue that every new ATXraspi user is GOING to have from now on?

Perhaps a mod could pin this post or add a note in the install instructions?