Physical button execute script

@vpeter, @Portisch,
Hello, its that possible to made reboot to android command, map to one phisical button in the keymap editor/edit to keymap under CoreELEC?
I know its actually two command, I see that in the dialogbuttonmenu.
Maybe possible to made a script, and run to mapped button? Thanks

You can run python script from keyboard.xml file on some button press.

Start reading here for example.

Thanks for the links , I’m afraid my knowledge is little for make that proper…

Well, it is hard to give exact instructions if we don’t know your setup. For example what remote, did you made any adjustment, …

1 Like

Its normal Homatics remote, with flirc receiver, mapped the remote buttons to kodi.
Here ist my keymap.

<keymap>
<global>
<keyboard>
<key id="61524">reboot</key>
</keyboard>
</global>
<fullscreenvideo>
<keyboard>
<key id="61568">zoomin</key>
<key id="61569">playerprocessinfo</key>
<key id="61467">aspectratio</key>
<key id="61513">playerdebug</key>
</keyboard>
</fullscreenvideo>
</keymap>

I would like the reboot “61524” use to reboot to android instead.

Change key to

<key id="61524">RunScript(/storage/reboot_to_android.py)</key>

and then copy file reboot_to_android.py to /storage.

https://mega.nz/file/rQhUxIyQ#off71ZEZCmdpKwBvH8WVmQ00DCQ2gs6HM4pY4ePtM8E

You can do this manually or type this commands in ssh session

cd /tmp
megadl https://mega.nz/file/rQhUxIyQ#off71ZEZCmdpKwBvH8WVmQ00DCQ2gs6HM4pY4ePtM8E
mv reboot_to_android.py /storage/reboot_to_android.py

Reboot and check if works. If not enable kodi debug log and check inside for any errors.

If editing file /storage/.kodi/userdata/keymaps/keyboard.xml then XBMC.RunScript must be used.

File reboot_to_android.py:

#!/usr/bin/python
import subprocess
subprocess.call(["/usr/sbin/rebootfromnand"], shell=True)
subprocess.call(["/usr/sbin/reboot"], shell=True)

1 Like
special://masterprofile/keymaps/gen.xml
2023-04-30 15:38:30.944 T:1047    error <general>: Keymapping error: no such action 'xbmc.runscript(/storage/reboot_to_android.py)' defined
2023-04-30 15:38:30.945 T:1047     info <general>: Loading special://profile/keymaps/gen.xml
2023-04-30 15:38:30.945 T:1047    error <general>: Keymapping error: no such action 'xbmc.runscript(/storage/reboot_to_android.py)' defined

Instead of XBMC.RunScript try with RunScript only.

1 Like

Yes, that was the trick.
Works flawlessly :slight_smile:
Thanks for your time and help. :+1:

1 Like

Glad to help.

2 Likes

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