I have the following setup:
1.3) Satellite TV (non-CEC)
1.4) PS3 (CEC)
While the AVR does have a an option to default to HDMI 3 when in standby, it changes to HDMI 2 or HDMI 4 if I start up the RPi or the PS3 (which is all fine). The problem is, I can't change back to HDMI 3 after shutting down RPi / PS3 without starting the AVR first and use AVR's remote to change HDMI-Input. In most cases, I don't want to use the AVR for watching TV, the TV's speaker are fine for that..
So, I had the following idea "Use the RPi to send an appropriate CEC command, so the AVR switches to HDMI 3, although the RPi is still running". Basically, it works! But I got stuck to make is comfortable as I want to have it.
First, what is possible right now:
With the latest XBian-Image (Raspbmc does not work, because cec-client is not included), I can connect via ssh to the RPi and execute the one liner:
Code: Select all
echo "tx 4f 82 13 00" | cec-client -s
This is not perfect, as it starts a new cec-client and messes up the XBMC-CEC implementation. But it's a starting point.
Basically, what I want to achieve is to have a single command in XBMC-UI that executes the command and changes AVR's input.
I think, I have two options here:
1) Execute the command above as a shell script.
2) Use libCEC-API from Python directly
The first option seemed easier for me, so I wrapped it in a simple python script (and an additional shell script, shouldn't be necessary):
Code: Select all
[email protected]:~# cat hdmi3.sh #!/bin/sh echo "tx 4f 82 13 00" | cec-client -s [email protected]:~# cat hdmi3.py import os os.system('sh /root/hdmi3.sh')
Anyway, I think, that trying to go with the second option would be better anyway. But I'm no python expert, so I'd really appreciate, if anyone could give me some hints on how to make use of the libcec api from python.
PS: The basic idea can be extended of course. It'll be great to set the RPi in a "satellite receiver mode" and pass all incoming CEC commands to the receiver via gpio. But that will be a (too) long way for me..