So I am trying to get the RPi 2 to turn on/off the video output via the remote. So to do this, I created a keyboard.xml and added the required key maps to it. I am aware that .sh scripts are not working in OSMC, so I added a link to a .py which then uses subprocess.call to call the .sh script. All scripts have correct permissions and have been made executable.
So I ran a test that called a test.py which called a test.sh that just appended “OK” to a .txt file. This worked 100% correctly from within Kodi on a keypress, over SSL and via command line.
So I tried doing the exact same thing with the HDMI script. It will not work from within Kodi! It works fine over SSL or command line. I even put a test output line and tried spitting the output from the command (in the .sh) to a file. The test output line is there, but not the result of the execution! Its like the script just ends.
The code I am using for HDMI is “vcgencmd display_power 0” for off (and 1 for on).
I looked briefly at the kodi.log and its saying the script executed as expected:
01:21:06 102.716949 T:1957487152 DEBUG: Keyboard: scancode: 0x57, sym: 0x0124, unicode: 0x0000, modifier: 0x1000
01:21:06 102.717270 T:1957487152 DEBUG: OnKey: f11 (0xf09a) pressed, action is XBMC.RunScript(/home/osmc/hdmioff.py)
01:21:06 102.717888 T:1639334944 NOTICE: Thread LanguageInvoker start, auto delete: false
01:21:06 102.718109 T:1639334944 INFO: initializing python engine.
01:21:06 102.718208 T:1639334944 DEBUG: CPythonInvoker(4, /home/osmc/hdmioff.py): start processing
01:21:07 103.117165 T:1639334944 NOTICE: -->Python Interpreter Initialized<–
01:21:07 103.117500 T:1639334944 DEBUG: CPythonInvoker(4, /home/osmc/hdmioff.py): the source file to load is “/home/osmc/hdmioff.py”
01:21:07 103.117599 T:1639334944 WARNING: CPythonInvoker(4): Script invoked without an addon. Adding all addon modules installed to python path as fallback. Thi$
01:21:07 103.120537 T:1639334944 DEBUG: CPythonInvoker(4, /home/osmc/hdmioff.py): setting the Python path to /home/osmc:/usr/share/kodi/addons/script.module.x$
01:21:07 103.120796 T:1639334944 DEBUG: CPythonInvoker(4, /home/osmc/hdmioff.py): entering source directory /home/osmc
01:21:07 103.332787 T:1639334944 INFO: CPythonInvoker(4, /home/osmc/hdmioff.py): script successfully run
01:21:07 103.341873 T:1639334944 INFO: Python script stopped
01:21:07 103.342163 T:1639334944 DEBUG: Thread LanguageInvoker 1639334944 terminating