Problems using XBMC.System.Exec from keymap.xml
#1
Hi,

I can't seem to execute any script from keymap.xml, activated from a remote button.

<key id="206">XBMC.System.Exec("./.xbmc/userdata/toggle-on-off.sh")</key>


If I run the same script in console it works without any problems.

I scaled down the script to just one command line to just make it simple, but same error occurs.

I'm using the latest 4.0.5 OpenElec built on raspberry pi.

I've tried locating the error reading the debug, but all I can see is an audio failure. Could that be the error?

04:08:59 T:3057972000 ERROR: ActiveAE::Resume - failed to init
04:08:59 T:3057972000 FATAL: ProcessMessage: Failed to restart AudioEngine after return from external player


After pressing the button for executing the script, XBMC make a scratch noice in the speakers and after some seconds it hangs.

If I remove the script, but still have the same pointer i keymap.xml it seem to be the same error. It seems in that way the error is not related to the script.

output:
------

Execute script from remote button

04:08:54 T:2962224208 DEBUG: CecLogMessage - key pressed: 1 (21)
04:08:54 T:2962224208 DEBUG: PushCecKeypress - received key ce duration 0
04:08:54 T:3057972000 DEBUG: OnKey: 206 (0xce) pressed, action is XBMC.System.Exec("./.xbmc/userdata/toggle-on-off.sh")
04:08:54 T:3057955920 INFO: CAESinkALSA - Unable to open device "default" for playback
04:08:54 T:3057955920 NOTICE: Found 1 Lists of Devices
04:08:54 T:3057955920 NOTICE: Enumerated PI devices:
04:08:54 T:3057955920 NOTICE: Device 1
04:08:54 T:3057955920 NOTICE: m_deviceName : HDMI
04:08:54 T:3057955920 NOTICE: m_displayName : HDMI
04:08:54 T:3057955920 NOTICE: m_displayNameExtra:
04:08:54 T:3057955920 NOTICE: m_deviceType : AE_DEVTYPE_HDMI
04:08:54 T:3057955920 NOTICE: m_channels : FL,FR
04:08:54 T:3057955920 NOTICE: m_sampleRates : 8000,11025,16000,22050,24000,32000,41400,48000,88200,96000,176400,192000
04:08:54 T:3057955920 NOTICE: m_dataFormats : AE_FMT_FLOAT,AE_FMT_S32LE,AE_FMT_S16LE,AE_FMT_AC3,AE_FMT_DTS,AE_FMT_EAC3
04:08:54 T:3057955920 NOTICE: Device 2
04:08:54 T:3057955920 NOTICE: m_deviceName : Analogue
04:08:54 T:3057955920 NOTICE: m_displayName : Analogue
04:08:54 T:3057955920 NOTICE: m_displayNameExtra:
04:08:54 T:3057955920 NOTICE: m_deviceType : AE_DEVTYPE_PCM
04:08:54 T:3057955920 NOTICE: m_channels : FL,FR
04:08:54 T:3057955920 NOTICE: m_sampleRates : 48000
04:08:54 T:3057955920 NOTICE: m_dataFormats : AE_FMT_FLOAT,AE_FMT_S32LE,AE_FMT_S16LE
04:08:54 T:3048207440 INFO: CActiveAESink::OpenSink - initialize sink
04:08:54 T:3048207440 DEBUG: CActiveAESink::OpenSink - trying to open device PI:HDMI
04:08:54 T:3048207440 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000008
04:08:54 T:3048207440 DEBUG: CAESinkPi:Initialize Format:15 Channels:2 Samplerate:44100 framesize:8 bufsize:17640 bytes/s=352800.00
04:08:54 T:3048207440 DEBUG: CAESinkPi:Initialize
04:08:54 T:3048207440 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_render input port 100 output port 100 m_handle 0xacca7dd8
04:08:54 T:3048207440 DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_render) - port(100), nBufferCountMin(1), nBufferCountActual(2), nBufferSize(17640), nBufferAlignmen(16)
04:08:54 T:3048207440 DEBUG: CActiveAESink::OpenSink - SinkPi Initialized:
04:08:54 T:3048207440 DEBUG: Output Device : HDMI
04:08:54 T:3048207440 DEBUG: Sample Rate : 44100
04:08:54 T:3048207440 DEBUG: Sample Format : AE_FMT_FLOAT
04:08:54 T:3048207440 DEBUG: Channel Count : 2
04:08:54 T:3048207440 DEBUG: Channel Layout: FL,FR
04:08:54 T:3048207440 DEBUG: Frames : 2205
04:08:54 T:3048207440 DEBUG: Frame Samples : 4410
04:08:54 T:3048207440 DEBUG: Frame Size : 8
04:08:54 T:3057955920 DEBUG: CActiveAE::ClearDiscardedBuffers - buffer pool deleted
04:08:54 T:2962224208 DEBUG: CecLogMessage - >> 01:8b:21
04:08:54 T:2962224208 DEBUG: CecLogMessage - >> TV (0) -> Recorder 1 (1): vendor remote button up (8B)
04:08:54 T:2962224208 DEBUG: CecLogMessage - key released: 1 (21)
04:08:54 T:2962224208 DEBUG: PushCecKeypress - received key ce duration 432
04:08:59 T:3057972000 ERROR: ActiveAE::Resume - failed to init
04:08:59 T:3057972000 FATAL: ProcessMessage: Failed to restart AudioEngine after return from external player
04:09:01 T:2962224208 DEBUG: CecLogMessage - >> 0f:86:20:00
04:09:01 T:2962224208 DEBUG: CecLogMessage - >> TV (0) -> Broadcast (F): set stream path (86)
04:09:01 T:2962224208 DEBUG: CecLogMessage - >> TV (0) sets stream path to physical address 2000

Executing a script that doesn’t exist, from the same button:

OpenELEC:~ # cd ./.xbmc/userdata/
OpenELEC:~/.xbmc/userdata # mv toggle-on-off.sh toggle-on-off.old

04:45:15 T:2962224208 DEBUG: CecLogMessage - >> TV (0) -> Recorder 1 (1): user control pressed (44)
04:45:15 T:2962224208 DEBUG: CecLogMessage - key pressed: 1 (21)
04:45:15 T:2962224208 DEBUG: PushCecKeypress - received key ce duration 0
04:45:15 T:3058479904 DEBUG: OnKey: 206 (0xce) pressed, action is XBMC.System.Exec("./.xbmc/userdata/toggle-on-off.sh")
04:45:15 T:3048207440 DEBUG: CAESinkPiBig Grinrain delay:72ms now:0ms
04:45:15 T:3048207440 DEBUG: CAESinkPiBig Grineinitialize
04:45:15 T:3048207440 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000000
04:45:15 T:3048207440 DEBUG: COMXCoreComponent:Big Grineinitialize : OMX.broadcom.audio_render handle 0xacc9f8e0
04:45:15 T:3058463824 INFO: CAESinkALSA - Unable to open device "default" for playback
04:45:15 T:3058463824 NOTICE: Found 1 Lists of Devices
04:45:15 T:3058463824 NOTICE: Enumerated PI devices:
04:45:15 T:3058463824 NOTICE: Device 1
04:45:15 T:3058463824 NOTICE: m_deviceName : HDMI
04:45:15 T:3058463824 NOTICE: m_displayName : HDMI
04:45:15 T:3058463824 NOTICE: m_displayNameExtra:
04:45:15 T:3058463824 NOTICE: m_deviceType : AE_DEVTYPE_HDMI
04:45:15 T:3058463824 NOTICE: m_channels : FL,FR
04:45:15 T:3058463824 NOTICE: m_sampleRates : 8000,11025,16000,22050,24000,32000,41400,48000,88200,96000,176400,192000
04:45:15 T:3058463824 NOTICE: m_dataFormats : AE_FMT_FLOAT,AE_FMT_S32LE,AE_FMT_S16LE,AE_FMT_AC3,AE_FMT_DTS,AE_FMT_EAC3
04:45:15 T:3058463824 NOTICE: Device 2
04:45:15 T:3058463824 NOTICE: m_deviceName : Analogue
04:45:15 T:3058463824 NOTICE: m_displayName : Analogue
04:45:15 T:3058463824 NOTICE: m_displayNameExtra:
04:45:15 T:3058463824 NOTICE: m_deviceType : AE_DEVTYPE_PCM
04:45:15 T:3058463824 NOTICE: m_channels : FL,FR
04:45:15 T:3058463824 NOTICE: m_sampleRates : 48000
04:45:15 T:3058463824 NOTICE: m_dataFormats : AE_FMT_FLOAT,AE_FMT_S32LE,AE_FMT_S16LE
04:45:15 T:3048207440 INFO: CActiveAESink::OpenSink - initialize sink
04:45:15 T:3048207440 DEBUG: CActiveAESink::OpenSink - trying to open device PI:HDMI
04:45:15 T:3048207440 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000008
04:45:15 T:3048207440 DEBUG: CAESinkPi:Initialize Format:15 Channels:2 Samplerate:44100 framesize:8 bufsize:17640 bytes/s=352800.00
04:45:15 T:3048207440 DEBUG: CAESinkPi:Initialize
04:45:15 T:3048207440 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_render input port 100 output port 100 m_handle 0xacc4d308
04:45:15 T:3048207440 DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_render) - port(100), nBufferCountMin(1), nBufferCountActual(2), nBufferSize(17640), nBufferAlignmen(16)
04:45:15 T:3048207440 DEBUG: CActiveAESink::OpenSink - SinkPi Initialized:
04:45:15 T:3048207440 DEBUG: Output Device : HDMI
04:45:15 T:3048207440 DEBUG: Sample Rate : 44100
04:45:15 T:3048207440 DEBUG: Sample Format : AE_FMT_FLOAT
04:45:15 T:3048207440 DEBUG: Channel Count : 2
04:45:15 T:3048207440 DEBUG: Channel Layout: FL,FR
04:45:15 T:3048207440 DEBUG: Frames : 2205
04:45:15 T:3048207440 DEBUG: Frame Samples : 4410
04:45:15 T:3048207440 DEBUG: Frame Size : 8
04:45:15 T:3058463824 DEBUG: CActiveAE::ClearDiscardedBuffers - buffer pool deleted
04:45:15 T:2962224208 DEBUG: CecLogMessage - >> 01:8b:21
04:45:15 T:2962224208 DEBUG: CecLogMessage - >> TV (0) -> Recorder 1 (1): vendor remote button up (8B)
04:45:15 T:2962224208 DEBUG: CecLogMessage - key released: 1 (21)
04:45:15 T:2962224208 DEBUG: PushCecKeypress - received key ce duration 345
04:45:20 T:3058479904 ERROR: ActiveAE::Resume - failed to init
04:45:20 T:3058479904 FATAL: ProcessMessage: Failed to restart AudioEngine after return from external player
04:45:22 T:2962224208 DEBUG: CecLogMessage - >> 0f:86:20:00
04:45:22 T:2962224208 DEBUG: CecLogMessage - >> TV (0) -> Broadcast (F): set stream path (86)
04:45:22 T:2962224208 DEBUG: CecLogMessage - >> TV (0) sets stream path to physical address 2000
04:46:15 T:3048207440 DEBUG: CAESinkPiBig Grinrain delay:100ms now:0ms
04:46:25 T:3048207440 DEBUG: CAESinkPiBig Grineinitialize
04:46:25 T:3048207440 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000000
04:46:25 T:3048207440 DEBUG: COMXCoreComponent:Big Grineinitialize : OMX.broadcom.audio_render handle 0xacc4d308



Execute script from console

OpenELEC:~ # cat ./.xbmc/userdata/toggle-on-off.sh
#!/bin/bash

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params" {"title":"HAmbiSync (HUE Ambilight Syncronization)","message":"Disabled","image":"./hyperion.png"}}' http://127.0.0.1:80/jsonrpc



OpenELEC:~ # ./.xbmc/userdata/toggle-on-off.sh
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> POST /jsonrpc HTTP/1.1
> User-Agent: curl/7.36.0
> Host: 127.0.0.1
> Accept: application/json
> Content-type: application/json
> Content-Length: 164
>
* upload completely sent off: 164 out of 164 bytes
< HTTP/1.1 200 OK
< Content-Length: 38
< Content-Type: application/json
< Date: Sat, 21 Jun 2014 02:18:52 GMT
<
* Connection #0 to host 127.0.0.1 left intact
{"id":1,"jsonrpc":"2.0","result":"OK"}OpenELEC:~ #


04:18:52 T:2896163920 DEBUG: webserver: request received for /jsonrpc
04:18:52 T:2896163920 DEBUG: JSONRPC: Value does not match any of the enum values in type
04:18:52 T:3058479904 DEBUG: ------ Window Init (DialogKaiToast.xml) ------
04:18:52 T:3048207440 INFO: CActiveAESink::OpenSink - initialize sink
04:18:52 T:3048207440 DEBUG: CActiveAESink::OpenSink - trying to open device PI:HDMI
04:18:52 T:3048207440 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000008
04:18:52 T:3048207440 DEBUG: CAESinkPi:Initialize Format:15 Channels:2 Samplerate:44100 framesize:8 bufsize:17640 bytes/s=352800.00
04:18:52 T:3048207440 DEBUG: CAESinkPi:Initialize
04:18:52 T:3048207440 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_render input port 100 output port 100 m_handle 0xacc9fde0
04:18:52 T:3048207440 DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_render) - port(100), nBufferCountMin(1), nBufferCountActual(2), nBufferSize(17640), nBufferAlignmen(16)
04:18:52 T:3048207440 DEBUG: CActiveAESink::OpenSink - SinkPi Initialized:
04:18:52 T:3048207440 DEBUG: Output Device : HDMI
04:18:52 T:3048207440 DEBUG: Sample Rate : 44100
04:18:52 T:3048207440 DEBUG: Sample Format : AE_FMT_FLOAT
04:18:52 T:3048207440 DEBUG: Channel Count : 2
04:18:52 T:3048207440 DEBUG: Channel Layout: FL,FR
04:18:52 T:3048207440 DEBUG: Frames : 2205
04:18:52 T:3048207440 DEBUG: Frame Samples : 4410
04:18:52 T:3048207440 DEBUG: Frame Size : 8
04:18:58 T:3058479904 DEBUG: ------ Window Deinit (DialogKaiToast.xml) ------
04:19:03 T:2962224208 DEBUG: CecLogMessage - >> 0f:86:20:00
04:19:03 T:2962224208 DEBUG: CecLogMessage - >> TV (0) -> Broadcast (F): set stream path (86)
04:19:03 T:2962224208 DEBUG: CecLogMessage - >> TV (0) sets stream path to physical address 2000
04:19:14 T:3058479904 DEBUG: CAnnouncementManager - Announcement: OnScreensaverActivated from xbmc
04:19:14 T:3058479904 DEBUG: GOT ANNOUNCEMENT, type: 4, from xbmc, message OnScreensaverActivated
04:19:15 T:3058479904 DEBUG: ------ Window Init () ------

----
Reply
#2
Been there done that...

Only suggestion is to do it in python (which will work for you).
Reply
#3
@dfuct if you are trying to control your philips hue lights you might be able to get some ideas from the existing hue addon.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#4
(2014-06-22, 06:42)doug Wrote: Been there done that...

Only suggestion is to do it in python (which will work for you).

Actually I get to work using XBMC.System.Exec. The error seems to be the location. When changing ./ to mapped location it worked.

./.xbmc/userdata/toggle-on-off.sh --> /storage/.xbmc/userdata/toggle-on-off.sh

Code:
XBMC.System.Exec("/storage/.xbmc/userdata/toggle-on-off.sh")


However, the "click" in audio still reamins when using this, so I followed your advice of executing from python.

Replacing XBMC.System.Exec("") with RunScript() removed the the interrupted audio noice.

Code:
RunScript(/storage/.xbmc/userdata/toggle-on-off.py)


Any of those will execute the script.

toggle-on-off.py

Code:
import os
os.system('/storage/.xbmc/userdata/toggle-on-off.sh')

toggle-on-off.py

Code:
import subprocess
subprocess.call('/storage/.xbmc/userdata/toggle-on-off.sh', shell=True)



(2014-06-22, 06:48)nickr Wrote: @dfuct if you are trying to control your philips hue lights you might be able to get some ideas from the existing hue addon.

Indeed, you'r right and seems like a more simple way, but when I looked into it before it didn't seem to be able to control the light sources individually using different maps.

The advantage of HAmbiSync is that it can control individual light sources from specific ambilight locations (top-left, mid-left, down-left etc.), this is really an advantage when you have multiple light sources in difference locations from the TV, controlled to match the nearest zone of the screen.

I run this on my raspberry, although it requires java and it takes about 30-40% cpu usage it still works fine beside XBMC @ 1080p (over clicked @ static 900, 333, 450).

http://amip.tools-for.net/wiki/misc/hambisync
Reply

Logout Mark Read Team Forum Stats Members Help
Problems using XBMC.System.Exec from keymap.xml0