Hello how are you all doing?
I've been struggling to find a way to make this script works.
I have a X735 board from Suptronics. I want to shutdown my Rock Pi4 + X735 whenever I send the command "poweroff". By default they gpio that has this feature is the number 131(pin 12).
I created the script .config/shutdown.sh with the following content:
#!/bin/sh
if [ "$1" != "reboot" ]; then
BUTTON=131
#setup GPIO 18 as output and set to HIGH
echo "$BUTTON" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$BUTTON/direction
echo "1" > /sys/class/gpio/gpio$BUTTON/value
SLEEP=4 #set to 4 for shutdown, set to 1 for reboot.
echo "X730 Shutting down..."
/bin/sleep $SLEEP
fi
Display More
What is happening is:
If I type "halt":
Rock Pi: Goes off with all leds off
X735: Goes off with all leds off
If I type "poweroff":
Rock PI: Goes off but with green led on
X735: Stays on
I also tried to make a script called .config/x735.sh with the following script:
#!/bin/sh
BUTTON=131
#setup GPIO 18 as output and set to HIGH
echo "$BUTTON" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$BUTTON/direction
echo "1" > /sys/class/gpio/gpio$BUTTON/value
SLEEP=4 #set to 4 for shutdown, set to 1 for reboot.
echo "X730 Shutting down..."
/bin/sleep $SLEEP
Display More
And it works normally shutting everything off like expected.
So I believe it's something related to my scripts, I also tried to use systemd to run the x735.sh script before the shutdown but it never works.