Using Libreelec 10 beta 2, I am trying to map a keyboard f12 key to this System.Exec() call in order to toggle the AV mode over a tcp socket from my keyboard or remote.
It seems to do something because if I press f12 twice it resets Kodi, so something is wrong and I could use some help or suggestions for a better way to accomplish the same thing. It does not toggle the AV mode like the command does in an ssh window.
I tried to use log file uploader, but it crashed. I send a one of the log files and try again with the log file uploader if needed.
Per the log, I can see that the keymap is applied when f12 is pressed and it tries to run python3 /storage/.kodi/userdata/keymaps/AVMD0.py. The command python3 /storage/.kodi/userdata/keymaps/AVMD0.py or /usr/bin/python3 /storage/.kodi/userdata/keymaps/AVMD0.py runs perfectly from an ssh command line.
keymap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<global>
<keyboard>
<f12>System.Exec(/usr/bin/python3 /storage/.kodi/userdata/keymaps/AVMD0.py)</f12>
</keyboard>
</global>
</keymap>
AVMD0.py:
import sys
import socket
tcpsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpsocket.connect( ('192.168.1.206', 10002) )
tcpsocket.sendall(b'\rAVMD0 \r')
data = tcpsocket.recv(1024)
tcpsocket.close()
#print('Received', repr(data))
exit
Two F12 key presses from the log:
2021-05-11 11:20:23.544 T:1344 DEBUG <general>: Keyboard: scancode: 0x60, sym: 0x0125, unicode: 0x0000, modifier: 0x0
2021-05-11 11:20:23.544 T:1344 DEBUG <general>: HandleKey: f12 (0xf09b) pressed, action is System.Exec(python3 /storage/.kodi/userdata/keymaps/AVMD0.py)
2021-05-11 11:20:23.877 T:1344 DEBUG <general>: Keyboard: scancode: 0x60, sym: 0x0125, unicode: 0x0000, modifier: 0x0
2021-05-11 11:20:25.691 T:1344 INFO <general>: Skipped 1 duplicate messages..
2021-05-11 11:20:25.691 T:1344 DEBUG <general>: HandleKey: f12 (0xf09b) pressed, action is System.Exec(python3 /storage/.kodi/userdata/keymaps/AVMD0.py)
Thanks in advance for any help with this!