blue-merle: Fixes shutdown

This commit is contained in:
Jakob Rieck 2023-10-18 15:48:11 +02:00
parent 5d8efbb4e3
commit b97c0f06eb
3 changed files with 7 additions and 5 deletions

View File

@ -121,7 +121,7 @@ case $answer in
esac
if [[ "$answer" -eq 1 ]]; then
echo '{ "msg": "Shutting down..." }' > /dev/ttyS0
halt -d 5
echo '{ "poweroff": "1" }' > /dev/ttyS0
else
echo "Resetting modem..."
until gl_modem AT AT+QPOWD | grep -q OK

View File

@ -61,11 +61,14 @@ sleep 5
i=5
/sbin/poweroff -d $i
until [[ $i -eq 0 ]]
do
i=$((i-1))
mcu_send_message "Shutting down... ($i)"
sleep 1
done
logger -p notice -t blue-merle-toggle "Finished with Stage 2"
# Note: calling /sbin/poweroff directly results in the device rebooting into a broken state
echo '{ "poweroff": "1" }' >/dev/ttyS0

View File

@ -34,11 +34,10 @@ elif [ "$1" == "shutdown-modem" ]; then
exec gl_modem AT AT+CFUN=4
elif [ "$1" == "shutdown" ]; then
echo '{ "msg": "Shutdowing down..." }' > /dev/ttyS0
halt -d 5
show_message "Shutting down..."
echo -n "Shutting down"
poweroff -d 5
logger -p notice -t blue-merle-libexec "Shutting down"
echo '{ "poweroff": "1" } > /dev/ttyS0
elif [ "$1" == "write-imei" ]; then
new_imei=$2