Bluetooth soft shutdown and wakeup

I have conceived a soft - shutdown method implemented by Bluetooth. Specifically, the power key of the Bluetooth remote control triggers a script. The script executes the systemctl stop kodi and systemctl start kodi commands according to whether kodi is in the running or dead state. Because systemctl stop kodi will trigger the linked shutdown of CEC, it will be helpful to some extent for machines that cannot be shut down or woken up. Can anyone help me implement it? im a newbee for coding.

til now i use ai coding a udev rules below

ACTION=="press", SUBSCRIBE=="input/event5", ATTRS{name}=="SKYWORTH_0170", ATTRS{phys}=="04:7f:0e:52:46:55", KEYCODE=="70066", RUN+="/flash/custom_power_script.sh"

and a sh below

status_info=$(systemctl status kodi)
active_status=$(echo "$status_info" | grep -oP 'Active: \K.*?(?=;)' | awk '{print $1}')
echo $active_status
if [ "$active_status" = "active (running)" ]; then
    systemctl stop kodi
else
    systemctl start kodi
fi

but cannot work :rofl:

I had created a systemd service to put the board in suspend to idle. This freezes all processes and shuts off all CPUs except CPU0. It does require an IR power scancode to wake.

If your remote has both BT+IR functionality and the box has an IR receiver it might work for you. The SEI remote falls back to IR in s2idle, IR can then wake, and the remote repaired by BT.

Otherwise, the service might give you some ideas for your setup.

Done!.Launching script via remote when Kodi is stopped - #8 by ctyrka

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.