HDMI-CEC is a device control protocol that runs over HDMI cables.
It allows rudimentary control over HDMI-CEC aware devices - these devices oftern have vendor-specific names for the protocol, such as AnyNet+ for Samsung devices.
HDMI-CEC devices have tow key public properties - a logical address and a physical address. The physical address is determined by the ports a device is plugged into. HDMI is effectively a tree structure, with the TV/Display defaulting to physical address 0.0.0.0 (I understand there should only be 1 display in a HDMI setup, but exceptions apparently can be sometimes tolerated depending on the equipment)
If a device with other HDMI ports (referred to as a switch) is plugged in, any devices plugged into that will get a number in the the next "dot range".
So if an AV Receiver is plugged into port 1 of the tv, it would have physical address 22.214.171.124
if the MythTv HDMI out is plugged into port 3 of the AV receiver above, its physical address should be 126.96.36.199
Subsequently, any device directly attached to the switch gets a number based on the port it is plugged into. Typically devices determine their physical address via DDC, but as some CEC bridges are not "inline" with the source device they cannot dynamically determine the physical address. (These devices, such as the RainShadowTech one can have their physical address set to allow them to "impersonate" the non-hdmi-cec device - such as a typical HDMI-capable video card.
Secondly, there is a "Logical Address" which largely determines the type of device - and supports negotiation if multiple instances of the same type are on the HDMI tree (ie two bluray players etc). However, the Logical address is used when addressing devices, not the physical address. The Physical address is used when a "source Device" is in playback mode, and alerts all other devices that it is sending a stream to the display device via the path inherent in its physical address.
There are new devices becoming coming available that support a USB-HDMI bridge - some of these are
- RainShadowTech http://www.rainshadowtech.com (used for the purposes of this page). - kwikwai http://www.kwikwai.com/ (not tested) - pulse-eight http://www.pulse-eight.com/store
These instructions have been developed using the RainshadowTech device - differences will exist.
The RainShadowTech device exposes a device under /dev that can be read from or written to, with a simple "language" that slightly abstracts from the raw HDMI codes.
One very useful site is the www.cec-o-matic.com site, developed by kwikwai (http://www.kwikwai.com/)
Useful things that can be done with MythTv and HDMI-CEC: - allowing the TV remote control to send commands to Mythtv (via custom comand-line bridge and Mythfront end remote control socket)
- allowing MythTv to automatically set the AV receiver to the correct input whenever playback begins (via MythTV System Event) The following code (saved to a file and marked executable) will turn on the TV, and set the correct AV input when MythTv starts playback
#!/bin/sh # Broadcast active path to every device (Destination Device = f [broadcast message], 0x82 = active path, path is 1300 (3rd device, plugged into 1st device in display) echo \!xf 821300~ > /dev/ttyACM0 # tell active path to AV reciever (Destination Device = 5 [Av receiver], 0x82 = active path, path is 1300 (3rd device, plugged into 1st device in display) echo \!x5 821300~ > /dev/ttyACM0 # Turn on Display (Destination Device = 0 [Display], 0x04 = power on) echo \!x0 04~ > /dev/ttyACM0
Code to send volume up to av receiver (save it to an executable file, and configure irexec to execute the file on appropriate remote key press)
#!/bin/sh # Increase volume (Destination Device = 5 [Av receiver], 0x44 = Send Key, key code is 41 (Vol up) echo \!x5 4441~ > /dev/ttyACM0
example lircrc setting
begin prog = irexec button = Vol+ repeat = 0 config = /home/mythtv/hdmi-cec/volup end
Code to send volume down to AV receiver (save to /home/mythtv/hdmi-cec/voldown, chmod +x) NOTE - there is a security risk associated with irexec and custom bash files, but if this is your home HTPC, take your chances...
---- #!/bin/sh # Decrease volume (Destination Device = 5 [Av receiver], 0x44 = Send Key, key code is 42 (Vol down) echo \!x5 4442~ > /dev/ttyACM0 ----
example lircrc setting
begin prog = irexec button = Vol- repeat = 0 config = /home/mythtv/hdmi-cec/voldown end
Things that would be nice for MythTv to support in HDMI-CEC:
- setting the hostname for HDMI-CEC device discovery (maybe could be done through System Event?) - support recording from non-mythtv TV Mheg display
There is also implementation in 0.25 of use of http://libcec.pulse-eight.com/ - I will be trying this soon.