Hello everybody. First post here!
I need help with a Pimoroni ON/OFF shim that is not working as expected since a while.
when i opened the config file in /etc/cleanshutd.config , this was completely blank.
So, as I think that it should be, i re-wrote the following:
# Config for cleanshutd
# Commented out values will be reverted to defaults,
# and may not work on any given board.
# OnOff SHIM uses trigger 17 and poweroff 4
# Zero Lipo uses trigger 4 and poweroff off
# pHAT BEAT uses trigger 12 and powerof off
# Default values are trigger 4 and poweroff off
daemon_active=1
trigger_pin=17
led_pin=17
poweroff_pin=4
hold_time=1
shutdown_delay=0
polling_rate=1
the SHIM still doesn’t work, even though now the led is lighting when i press the on/off button. Looks like the RPi doesn’t detect the BCM17 held down.
I tried rebooting many times but no luck.
I also tried to fresh install a version of the RPi OS and run the one-line installer:
curl https://get.pimoroni.com/onoffshim | bash
but after rebooting, the /etc/cleanshutd.config file was again completely blank… therefore i wrote again the same:
# Config for cleanshutd
# Commented out values will be reverted to defaults,
# and may not work on any given board.
# OnOff SHIM uses trigger 17 and poweroff 4
# Zero Lipo uses trigger 4 and poweroff off
# pHAT BEAT uses trigger 12 and powerof off
# Default values are trigger 4 and poweroff off
daemon_active=1
trigger_pin=17
led_pin=17
poweroff_pin=4
hold_time=1
shutdown_delay=0
polling_rate=1
but the SHIM is yet not working. only the led on the board is lighting up.
Both now and before the fresh install, the file gpio-poweroff, located in /lib/systemd/system-shutdown, contains:
#! /bin/sh
# file: /lib/systemd/system-shutdown/gpio-poweroff
# $1 will be either "halt", "poweroff", "reboot" or "kexec"
poweroff_pin=""
led_pin=""
config_file=/etc/cleanshutd.conf
if [ -f "$config_file" ]; then
/bin/echo "Reading config file $config_file"
poweroff_pin=`grep -r '^poweroff_pin=[0-9]*$' "$config_file" | cut -f2- -d=`
led_pin=`grep -r '^led_pin=[0-9]*$' "$config_file" | cut -f2- -d=`
fi
case "$1" in
poweroff)
if [ "$poweroff_pin" = "" ]; then
/bin/echo "Skipping GPIO power-off" && exit 0
else
/bin/echo "Using power off pin $poweroff_pin"
fi
if [ ! "$led_pin" = "" ]; then
/bin/echo "Using LED pin $led_pin"
/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
fi
/bin/echo $poweroff_pin > /sys/class/gpio/export
/bin/echo out > /sys/class/gpio/gpio$poweroff_pin/direction
/bin/echo 0 > /sys/class/gpio/gpio$poweroff_pin/value
/bin/sleep 0.5
;;
esac
:
Can you help me figure out what’s wrong?
Thanks a lot