问题
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