2

I am trying to control (volume control and perhaps on/off) a Samsung TV over CEC from an Amlogic Android box.

The Android docs explain the theory of it but there is no actual code to implement, I have seen users communicate through cmd commands in sys/class/cec/cmd but this folder is nonexistent in my Amlogic box. I believe I need to install libcec (not sure though) into my box but this seems to be the non-Android way (I was expecting to use the HdmiControlManager class but it is unreachable).

The TV definitely has CEC (Anynet+).

This question summarises part of the problem Send HDMI CEC Command from Android Application but it has no answers.

My device doesn't even contain a sys/class/cec folder in which to run CEC commands like here: Samsung TV (anynet+) control with Android Device using HDMI CEC

Any ideas on how to achieve this? Through the Android framework or without it?

sgtpotatoe
  • 340
  • 6
  • 17
  • did you found any answer? – flakerimi Aug 20 '19 at 13:56
  • 1
    @flakerimi well we had a range of android boxes, and those with the sys/class/cec/cmd folder we were able to use to send cec commands through. We gave up on the other boxes as it wasn't a issue of big importance if we didn't use them! Let me know if there is anything else you would like to know – sgtpotatoe May 15 '20 at 12:08
  • @flakerimi is it possible for android phones to send cec commands over tv such as change video output mode , turn off /on the TV – babbin tandukar Nov 09 '20 at 11:11
  • @babbintandukar well cec commands are those that go through HDMI so the commands you send to the device travel through hdmi to the tv, if you mean non cec, IR commands to control your TV, there is universal TV remote apps out there but basically you need your phone to have an infra red emmiter and check what frequencies are each command and stuff, haven't done that before though, here is a related question https://stackoverflow.com/questions/46866909/using-infrared-sensor-in-my-app-for-tv-remote-control – sgtpotatoe Nov 10 '20 at 10:24
  • @sgtpotatoe i have made my app to get build using hidden apis and got my code for sending hdmi-cec commands from here but still confused on how to handle code to send cec commands https://android.googlesource.com/platform/frameworks/base/+/4e90fcd/core/java/android/hardware/hdmi/HdmiCecMessage.java the controls will be through hdmi cable connected to android phone using usb to hdmi adapters – babbin tandukar Nov 10 '20 at 11:56
  • 1
    @babbintandukar have you tried running a command like "echo 0x40 0x36 > /sys/class/cec/cmd" from an adb shell in your device? see if it works before implementing the code? – sgtpotatoe Nov 10 '20 at 13:51
  • @sgtpotatoe it would be very helpful if u can provide brief example how can i send command from adbshell to tv as my device will be connected to pc for adb shell instead of tv – babbin tandukar Nov 10 '20 at 17:23
  • @babbintandukar hmm could you start a question and post the link here so I can answer with code lines and a more detailed explanation? – sgtpotatoe Nov 11 '20 at 18:32

0 Answers0