# HDMI-CEC Control

**URL:** <https://community.xibo.org.uk/t/hdmi-cec-control/5202>\
**Category:** Android Player App\
**Created:** [February 28, 2016, 9:04pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202 "2016-02-28T21:04:36Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![aster](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@aster](https://community.xibo.org.uk/u/aster)\
**Post date:** [February 28, 2016, 9:04pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/1 "2016-02-28T21:04:36Z")

</div>

Hello everyone!  
As i am digging deeper in to Xibo I find myself wanting to do more things with it.

As the tile says it … HDMI-CEC control. Has anyone used/succeeded with it?  
I tried a lot of commands but nothing works so far.  
Interestingly enough my test Minix Neo-X6 box and Sharp Aquos TV seem to talk to each other both ways, But i am looking to control the TV from Xibo via the Minix box.

Thank you!

---

<div class="post-metadata">

**Author:** ![cslaughter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/cslaughter/32/186_2.png) [@cslaughter](https://community.xibo.org.uk/u/cslaughter)\
**Post date:** [February 29, 2016, 2:37am UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/2 "2016-02-29T02:37:53Z")

</div>

From what I understand you need to have at least Android version 5 and a kernel on the device that supports it with that device.

Is this what you have also found?

---

<div class="post-metadata">

**Author:** ![aster](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@aster](https://community.xibo.org.uk/u/aster)\
**Post date:** [February 29, 2016, 12:59pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/3 "2016-02-29T12:59:05Z")

</div>

Interesting about the Android 5, but I don’t think that is the case.  
As I wrote earlier My Minix Box seem to support it -\> if I put the TV in standby the Minix goes to standby as well and vice versa.  
What I am trying to achieve is the same as the shell commands but to control only the screen - I want the display to sleep not the Android box.  
BTW the Minix box is with Android 4.4.2 and form what I see it works as it has it as switch in its control panel.

what I found is this:  
[http://www.cec-o-matic.com/](http://www.cec-o-matic.com/)

Tried several codes but it doesn’t seem to respond as it does not seem to be a valid shell command.  
Also found some code about Raspbery Pi but still a no go .

---

<div class="post-metadata">

**Author:** ![cslaughter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/cslaughter/32/186_2.png) [@cslaughter](https://community.xibo.org.uk/u/cslaughter)\
**Post date:** [February 29, 2016, 6:07pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/4 "2016-02-29T18:07:38Z")

</div>

> [@aster](#):
>
> if I put the TV in standby the Minix goes to standby as well and vice versa.

Sounds like the hardware layer is communicating between the two. I think that to get to the software layer, you could use something like cec-o-matic. (I don’t know much about it, weather it is a hardware/software solution, or if they have a software only soution) But, I think you would need some application to be the go between for the Xibo/Android to cec-o-matic.

I think that utilizing Android hardware and a kernel that already supports CEC, like the unit you have, and then installing libCEC would be the way to go. The problem with this, is that libCEC is not directly available for Android.

I did find that recently someone posted online how to compile libCEC for Android, [here](http://0x1c3.blogspot.com/2015/09/libcec-compilation-for-android-example.html). I have not tried to compile it yet for Android. I belive that if libCEC was installed on an Android client that had hardware and kernel support for CEC, one could then pass CEC commands via Xibo to the Screen/Monitor using the Shell Command on a region in a layout.

> [@aster](#):
>
> Interesting about the Android 5, but I don’t think that is the case.

I mentioned Android 5 because Google/Alphabet introduced TIF into the OS and gives hardware using Android 5 a uniformed method of handle CEC communications. More [here](https://source.android.com/devices/tv/HDMI-CEC.html).

---

<div class="post-metadata">

**Author:** ![aster](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@aster](https://community.xibo.org.uk/u/aster)\
**Post date:** [March 13, 2016, 11:03am UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/5 "2016-03-13T11:03:07Z")

</div>

Sorry for the late replay but I had some troubles at work so yeah …  
So after a lot of compilation and tests I did not manage to control the screen via xibo and so I went for hardware control of the screens. Lame but it works. Electronic timers that can be set by days and hours. And the screen was set to power on upon mains restore 🙂  
I will be purchasing some more gear and will continue testing but for now I am on a dead end. Thanks all for the input !

---

<div class="post-metadata">

**Author:** ![cslaughter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/cslaughter/32/186_2.png) [@cslaughter](https://community.xibo.org.uk/u/cslaughter)\
**Post date:** [March 14, 2016, 2:04am UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/6 "2016-03-14T02:04:35Z")

</div>

aster,

Also, just for some more info, Alex pointed out to me in another discussion that the TIF is more than likely only included with the Android TV version of android.

But please do post any progress, as I am sure a number of users would love to hear of some way to do this.

---

<div class="post-metadata">

**Author:** ![aster](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@aster](https://community.xibo.org.uk/u/aster)\
**Post date:** [March 14, 2016, 1:13pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/7 "2016-03-14T13:13:12Z")

</div>

Will notify for any advancement I make I promise.  
I am currently deploying my system and man there is a lot of trouble …

Finance module is not reading data. Forecast is not working …

As soon as I iron these things out will continue wireless CEC control.

---

<div class="post-metadata">

**Author:** ![Guru\_Evi](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@Guru\_Evi](https://community.xibo.org.uk/u/Guru_Evi)\
**Post date:** [October 6, 2016, 4:44pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/8 "2016-10-06T16:44:52Z")

</div>

Not sure if anyone has figured anything out regarding this?

My client is asking for this as well. According to the Android docs, it’s built into the API and most TV boxes seem to support it (Minix and Amlogic)

[https://source.android.com/devices/tv/HDMI-CEC.html](https://source.android.com/devices/tv/HDMI-CEC.html)

It’s hard to ‘fix’ closed source software like Xibo for Android. I am really looking forward to something that’s hackable.

---

<div class="post-metadata">

**Author:** ![Guru\_Evi](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@Guru\_Evi](https://community.xibo.org.uk/u/Guru_Evi)\
**Post date:** [October 7, 2016, 3:37am UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/9 "2016-10-07T03:37:17Z")

</div>

Nevermind, I figured it out.

---

<div class="post-metadata">

**Author:** ![cslaughter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/cslaughter/32/186_2.png) [@cslaughter](https://community.xibo.org.uk/u/cslaughter)\
**Post date:** [October 11, 2016, 4:29am UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/10 "2016-10-11T04:29:15Z")

</div>

Can you please share?

---

<div class="post-metadata">

**Author:** ![Guru\_Evi](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@Guru\_Evi](https://community.xibo.org.uk/u/Guru_Evi)\
**Post date:** [October 11, 2016, 11:57pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/11 "2016-10-11T23:57:19Z")

</div>

You just have to compile LibCEC against the Android SDK. Then you can use the Xibo 1.8 commands to turn the TV on/off.

I’ve returned the Android I tested because it kept overheating and crashing but as soon as I get my replacement (Minix U1, cross fingers), I’ll be posting fresh instructions.

---

<div class="post-metadata">

**Author:** ![Guru\_Evi](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@Guru\_Evi](https://community.xibo.org.uk/u/Guru_Evi)\
**Post date:** [October 19, 2016, 4:52pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/12 "2016-10-19T16:52:01Z")

</div>

Here’s how I did it:

Install Android Studio and install the SDK, CMAKE support and NDK for whatever flavor of Android you’re compiling for. I used API version 22.

Make a working directory (eg mkdir ~/libcec; cd ~/libcec). Get libcec and p8-platform from the Github (or a release) and unpack it into that directory. In each directory I also created the directory build (so I could clean up easily (mkdir build)).

I am using this on an Amlogic device so I also have to compile Exynos support into it. If you have a Pulse-Eight adapter or another CEC device, you could avoid this. You basically add -DHAVE\_EXYNOS\_API=1 or -DHAVE\_TDA995X\_API=1 if you have either of those.

Then simply do this:

In platform/build do:  
cmake -DCMAKE\_TOOLCHAIN\_FILE=~/Library/Android/sdk/cmake/3.6.3155560/android.toolchain.cmake -DCMAKE\_INSTALL\_PREFIX:PATH=~/libcec/p8-platform/ -DANDROID\_ABI=“armeabi-v7a” -DANDROID\_STL=gnustl\_static -DANDROID\_TOOLCHAIN\_NAME=arm-linux-androideabi-4.9 …

Then:  
make install

In libcec-libcec-3.1.0/build do:  
cmake -DCMAKE\_TOOLCHAIN\_FILE=~/Library/Android/sdk/cmake/3.6.3155560/android.toolchain.cmake -DCMAKE\_INSTALL\_PREFIX:PATH=~/libcec/libcec/ -DANDROID\_ABI=“armeabi-v7a” -DANDROID\_STL=gnustl\_static -DANDROID\_TOOLCHAIN\_NAME=arm-linux-androideabi-4.9 -DCMAKE\_FIND\_ROOT\_PATH=~/libcec/p8-platform/ …

Then:  
make install

You now have ~/libcec/libcec folder with a bin/cec-client-3.1.0, bin/cecc-client-3.1.0 (as well as some symlinks) and lib/libcec.so.

Use adb push to copy the things onto your device into /system/bin/cec-client-3.1.0, /system/bin/cecc-client-3.1.0 and /system/lib/libcec.so.3.1.0 respectively. Then symlink ln -s /system/lib/libcec.so.3.1.0 /system/lib/libsec.so.3; ln -s /system/lib/libcec.so.3 /system/lib/libsec.so and (if you wish) symlink cec-client to cec-client-3.1.0.

Now find your CEC serial port device. It doesn’t exist by default on my Android so I have to do mknod /dev/CEC u 253 0. There is a /dev/amhdmitx0 but it’s not a typewriter device so it’s not usable by cec-client.

I currently don’t have a CEC-capable display (HDMI-\>DVI) but at least I get the response from the CEC processor that the TV is not present.

---

<div class="post-metadata">

**Author:** ![cslaughter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/cslaughter/32/186_2.png) [@cslaughter](https://community.xibo.org.uk/u/cslaughter)\
**Post date:** [October 19, 2016, 6:16pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/13 "2016-10-19T18:16:50Z")

</div>

Guru\_Evi,

You are awesome.

---

<div class="post-metadata">

**Author:** ![Guru\_Evi](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@Guru\_Evi](https://community.xibo.org.uk/u/Guru_Evi)\
**Post date:** [October 19, 2016, 6:41pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/14 "2016-10-19T18:41:20Z")

</div>

I can post the binaries although I’m unsure how useful they will be for your specific platform. The above instructions are fairly useful and easy (at least on a Mac).

I am working on a ‘finished’ Android player so I can just flash the player and it will have Xibo and cec-client. Now to find a CEC-compatible TV…

---

<div class="post-metadata">

**Author:** ![edup](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/edup/32/4353_2.png) [@edup](https://community.xibo.org.uk/u/edup)\
**Post date:** [December 19, 2017, 4:54pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/15 "2017-12-19T16:54:24Z")

</div>

So, thanks to @Guru_Evi I was able to compile cec-client to android. Thanks a lot for your instructions. As a note to the future, I had to add a flag -DANDROID\_PLATFORM=android-16 in order to be able to execute the command on android \>= 5.0, otherwise I was receiving the error " error: only position independent executables (PIE) are supported.".

I’ve added the flag -DHAVE\_EXYNOS\_API=1 and -DHAVE\_AOCEC\_API=1

Now I’m facing a problem of “command ‘PING’ was not acked by the controller”.

I’m running it on [this android dongle](http://bit.ly/2oNo2Eb).

The device /dev/cec is settled:

```
q8723bs:/ # ls -l /dev/cec                                                                                                                                              
crw-rw-rw- 1 root root 218, 0 2017-12-19 16:33 /dev/cec

```

I also can find it on /sys/class/cec:

```
q8723bs:/ # ls -laht /sys/class/cec/                                                                                                                                    
total 0
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 arc_port
lrwxrwxrwx 1 root root 0 2017-12-19 16:45 cec -> ../../devices/aocec/cec
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 cec_version
--w------- 1 root root 4.0K 2017-12-19 16:45 cmd
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 dbg_en
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 device_type
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 dump_reg
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 fun_cfg
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 menu_language
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 osd_name
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 physical_addr
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 pin_status
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 port_num
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 port_seq
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 port_status
-rw-rw-r-- 1 root root 4.0K 2017-12-19 16:45 vendor_id
-r--r--r-- 1 root root 4.0K 2017-12-19 16:45 wake_up
drwxr-xr-x 2 root root 0 2017-12-19 16:33 .
drwxr-xr-x 110 root root 0 2017-12-19 16:33 ..

```

But when I ran cec-client I receive this answer:

```
q8723bs:/ # id
uid=0(root) gid=0(root) groups=0(root) context=u:r:toolbox:s0
q8723bs:/ # cec-client -s /dev/cec                                                                                                                                      
opening a connection to the CEC adapter...
DEBUG: [1]	Broadcast (F): osd name set to 'Broadcast'
DEBUG: [2]	connection opened, clearing any previous input and waiting for active transmissions to end before starting
DEBUG: [396]	communication thread started
DEBUG: [1396]	command 'PING' was not acked by the controller

```

As a note, I also have the device /dev/input/event2 that is a read only cec\_input:

```
q8723bs:/ # ls -l /dev/input/event2                                                                                                                                     
crw-rw---- 1 root input 13, 66 2017-12-19 16:33 /dev/input/event2
q8723bs:/ # ls /sys/devices/virtual/input/input2/                                                                                                                      
capabilities/ event2/ id/ modalias name phys power/ properties subsystem/ uevent uniq
q8723bs:/ # cat /sys/devices/virtual/input/input2/name                                                                                                                  
cec_input

```

I tried to run it on /dev/input/event2 but obviously it didn’t work because it could not open a connection:

```
q8723bs:/ # cec-client /dev/input/event2                                                                                                                                
No device type given. Using 'recording device'
CEC Parser created - libCEC version 4.0.2
opening a connection to the CEC adapter...
DEBUG: [1]	Broadcast (F): osd name set to 'Broadcast'
ERROR: [3335]	error opening serial port '/dev/input/event2': Couldn't lock the serial port
ERROR: [3335]	could not open a connection (try 1)

```

Any thoughts to help me on this? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Guru\_Evi](https://community.xibo.org.uk/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@Guru\_Evi](https://community.xibo.org.uk/u/Guru_Evi)\
**Post date:** [December 19, 2017, 5:18pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/16 "2017-12-19T17:18:42Z")

</div>

A) Does your TV actually have CEC controls and is it enabled - this is often buried within TV set’s settings  
Anynet+ (Samsung)  
Aquos Link (Sharp)  
BRAVIA Link, BRAVIA Sync, Control for HDMI (Sony)  
CE-Link, Regza Link (Toshiba)  
E-link (AOC)  
EasyLink (Philips)  
Fun-Link (Funai, Sylvania, Emerson, Magnavox, Philips)  
HDMI-CEC (Hitachi)

B) Keep running in Debug mode and see if you do anything on the TV set that should passthrough (eg. if you have a Vizio, use one of the DVD controls) whether it shows up on the system. Make sure the system is on the first or master HDMI input, some Tv’s only support CEC on the first or first couple of HDMI inputs.

C) Use a high quality HDMI cable or another TV set, make sure there are no other devices (like a receiver) in the chain that could interfere.

You may eventually want to get an actual CEC USB dongle for your computer to see if the commands actually end up on the HDMI bus or not.

---

<div class="post-metadata">

**Author:** ![edup](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/edup/32/4353_2.png) [@edup](https://community.xibo.org.uk/u/edup)\
**Post date:** [December 21, 2017, 1:16pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/17 "2017-12-21T13:16:51Z")

</div>

A) I’ve tried with RPI (libecec) in the same tv and CEC commands works.

B) I have an LG. I will try the developer mode to check if I find any interesting log. Thanks.

C) I’m connecting the android dongle directly to the tv. No cables. I tried in both hdmi ports. No success.

I also posted my both approaches at [this](https://stackoverflow.com/questions/47892639/hdmi-cec-on-android) stackoverflow. If you have any more idea it would be very helpful since there are a lack of documentation about this subject. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://community.xibo.org.uk/uploads/default/original/2X/a/a8759c2d8cc561474733895ac75beeb830f5d8ca.png) [@system](https://community.xibo.org.uk/u/system)\
**Post date:** [March 4, 2020, 5:15pm UTC](https://community.xibo.org.uk/t/hdmi-cec-control/5202/18 "2020-03-04T17:15:33Z")

</div>

Closed on March 4, 2020, 5:15pm UTC


