Skip to content Skip to sidebar Skip to footer

Hdmi Cec On Android

I've been facing a problem to access to HDMI CEC on this android dongle. I'm trying to turn on the tv and change the input source of the tv but I was unable to it. Android API App

Solution 1:

So after a lot of work around this issue I figured out that, in order to have CEC control enabled in android you need to run this command on shell:

settings put global hdmi_control_enabled 1#if you want, you can also enable this self-explanatory command
settings put global hdmi_control_auto_wakeup_enabled 1#and this
settings put global hdmi_control_auto_device_off_enabled 1

After this, android automatically started to make use of cec, after a boot, for example, it change the input source of tv and/or turn on the tv.

Now, regarding developer control:

I understood, that when I call the method:

Methodm2= obj_HdmiControlManager.getClass().getMethod("getPlaybackClient");
         

I'm basically getting the access to CEC of the dongle itself (not the tv).

Though, I still continue to receive null when I run the method:

Methodmethod_getTvClient= obj_HdmiControlManager.getClass().getMethod("getTvClient");

My guess here is that this is a normal behaviour since the dongle itself is a playback type and not a TV type.

So I tried to use the function sendVendorCommand but I was not able to figure out how to use it. I couldn't found any documentation/examples around this subject that could help me.

So I decided to go directly through OS level and it worked. Specifically in this dongle, you have at /sys/class/cec two important files:

. cmd (to send cec commands)

e.g. (as root @ android shell )

#turn on tvecho 0x40 0x04 > /sys/class/cec/cmd

#change input source to HDMI 1echo 0x4F 0x82 0x10 0x00 > /sys/class/cec/cmd

. dump_reg ( to read output of cec)

Use this site to check codes for other commands

And That's it! I would prefer to execute those commands through android framework, but at least, this works.

Post a Comment for "Hdmi Cec On Android"