remap xbmc remote key to call shell script
#1
Hello. I have used XBMC on many different platforms over the years going back to the original xbox in 2004. I have always been able to figure out just about every question I have had by doing a search but this time I'm stumped. My problem is this:

I have Xubuntu 14.04 running on a older PC in my basement. I have a DVI to HDMI cable and a MCE USB IR receiver connected to it that run to the room directly above. Everything works fine after a fresh boot but once I turn the TV off something goes wrong with the HDMI handshake and the TV never re-detects the HDMI signal. This isn't too big of a deal because I can issue a xrandr command over SSH and it redirects the display and works fine.

So what I want to do is remap either the power key (I never power it off and don't need it) or the clear key on the MCE USB remote to call a script that then calls xrandr. I'm also using a Harmony remote so I can easily add that key press whenever the 'Use XBMC' activity starts.

First question:

Since I'm using a MCE USB IR receiver that I believe is detected as a standard keyboard, do I create a ~/.xbmc/userdata/keymap/keyboard.xml file or a ~/.xbmc/userdata/keymap/remote.xml? I have tried both and neither seem to work.

Second question:

I believe I have the content of the keyboard.xml and remote.xml files correct. remote.xml is:

Code:
<keymap>
        <global>
                <remote>
                        <clear>System.Exec("/home/spencer/.xbmc/userdata/fixhdmi.py")</clear>
                        <power>System.Exec("/home/spencer/.xbmc/userdata/fixhdmi.py")</power>
                </remote>
        </global>
</keymap>

and keyboard.xml is:

Code:
<keymap>
<global>
   <keyboard>
        <power>System.Exec("/home/spencer/.xbmc/userdata/fixhdmi.py")</power>
   </keyboard>
</global>
</keymap>

Should the System.Exec() reference the python script or a bash script? I tried both, with fixhdmi.py script as:

Code:
import os
os.system("/home/spencer/fixhdmi.sh")

and the fixhdmi.sh script just contains the xrandr command. I know the bash script works fine because I can call it independently.

So am I on the right track at all here? Is there something obvious I'm missing?

Rather than using <power> in keyboard.xml I have also tried <s> but neither work

Many thanks!

[EDIT: words]
Reply
#2
I knew after taking the time to write my first post I would figure it out. I have several problems above. All I need is a keyboard.xml file, not remote.xml.

The working file is:

Code:
<keymap>
<global>
<keyboard>
        <escape>XBMC.RunScript(/home/spencer/.xbmc/userdata/fixhdmi.py)</escape>
</keyboard>
</global>
</keymap>

and fixhdmi.ph contains:

Code:
import os
os.system("DISPLAY=:0 xrandr --output DVI1 --mode 1366x768")

Rather than having python call a shell script I just call xrandr directly.

Now that I have that part working I need to figure out which key to map from the harmony side. Whew..

EDIT: ended up using ctrl-i which is the pictures XBMC shortcut. On my MCE Remote this is the MyPictures button. After setting a delay and telling the Harmony remote to send that command when switching to the activity it works great
Reply

Logout Mark Read Team Forum Stats Members Help
remap xbmc remote key to call shell script0