i wanna stop/start kodi with bt remote.
i creat a hwdb file
evdev:input:b0005v000Dp3838*
KEYBOARD_KEY_c0041=enter
KEYBOARD_KEY_70066=f7
modify gen.xml
<keymap>
<global>
<keyboard>
<f7>RunScript(/storage/.config/standby.py)</f7>
</keyboard>
</global>
</keymap>
creat python script
#bluetooth remote control stop/start kodi
import subprocess
def is_kodi_running():
try:
result=subprocess.run(['pgrep','kodi'],stdout=subprocess.PIPE,text=True,check=True)
output=result.stdout.strip().split('\n')
if len(output)>1:
return True
else:
return False
except subprocess.CalledProcessError:
return False
if is_kodi_running():
subprocess.run(['systemctl','stop','kodi'])
else:
subprocess.run(['systemctl','start','kodi'])
SHH command.kodi can be stop/start
python /storage/.config/standby.py
when kodi is running,'70066’button can stop kodi.when kodi is dead,the button cannot start kodi.