Samsung TV (anynet+) control with Android Device using HDMI CEC

狂风中的少年 提交于 2019-12-08 03:14:50

问题


I am using command line to control the TV like power on, power off, volume up and volume down from rooted Android Device. i am able to power on and power off using the following command.

  Process p;
    try {
        p = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(p.getOutputStream());

        os.writeBytes("su" + "\n");
        // power on command
        os.writeBytes("echo 0x40 0x04" > /sys/class/cec/cmd" + "\n");
        os.writeBytes("exit\n");
        os.flush();
    } catch (IOException e) {
        e.printStackTrace();
    }

and same as to power off with

os.writeBytes("echo 0x40 0x36" > /sys/class/cec/cmd" + "\n");

but i am unable to control the volume. we can get the codes to send from the following website (http://www.cec-o-matic.com)

Commands for volume up and down

Volume up : os.writeBytes("echo 0x40 0x44 0x41" > /sys/class/cec/cmd" + "\n");

Volume down : os.writeBytes("echo 0x40 0x44 0x42" > /sys/class/cec/cmd" + "\n");

These commands are not working. Any reference or documentation regarding this will be much appreciated.

来源:https://stackoverflow.com/questions/49751659/samsung-tv-anynet-control-with-android-device-using-hdmi-cec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!