[HELP] GPIO signal during shutdown
-
Hello fellows,
According to the systemd helppage for system-halt we can initiate a script during shutoff sequence if we but a file to
/lib/systemd/system-shutdown/
path. According to the halt signal we can choose between shutdowns, reboots .....I'm able to use the file with full GPIO support on a PI0/1 and a PI2 ... So the LED blinks 3 times during shutdown. I'm not able to run this on a PI3 with RetroPie 4.3 and the STRETCH images also. So there seems no initiation of a GPIO during shutdown here.
So dear community I need your help. We need to connecte a LED to a working GPIO and to ground. then we need to create a small script and make it executable via chmod.
- type
sudo nano /lib/systemd/system-shutdown/gpio-shutoff
- Insert code from box below!
- Make script executable with
sudo chmod +x /lib/systemd/system-shutdown/gpio-shutoff
- Shutoff via commandline, ES menu or ....
example shutoff script!
#!/bin/sh # Testscript for proper GPIO signal on shutdown led_pin=17 /bin/echo $led_pin > /sys/class/gpio/export /bin/echo out > /sys/class/gpio/gpio$led_pin/direction for iteration in 1 2 3; do /bin/echo 0 > /sys/class/gpio/gpio$led_pin/value /bin/sleep 0.2 /bin/echo 1 > /sys/class/gpio/gpio$led_pin/value /bin/sleep 0.2 done /bin/sleep 5
So this script let's blink a LED connected to GPIO17 and GROUND
If you test can you please tell...
Which Raspberry did you use?
Which version of RetroPie or annother OS did you use?Thank you
cyperghostPS: @herb_fargus @BuZz any ideas? Link to starting thread
- type
-
Tested: on Raspberry Pi 3 with RetroPie 4.3 and RetroPie 4.4 - works
Tested: on Raspbian STRECH 4.9 kernel (March 2018) - worksThis is working flawless now!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.