Android - send HDMI CEC commands to TV - minix - libCEC

后端 未结 2 1885
予麋鹿
予麋鹿 2021-01-31 21:07

i\'m working on a Minix NEO X8-H (Android media center, 4.4.2) and i need to send HDMI-CEC command to TV: when my App receives a call i want to change automatically the TV Sourc

相关标签:
2条回答
  • 2021-01-31 21:45

    My two cents on the issue:

    Chapter I: Compassion

    I went through all the trouble you went, too, especially with libCEC, so I'd like to describe the only way I got any interaction going between an Android TV box and the TV connected to it with HDMI cable.

    Chapter II: Cooking low and slow

    Send a request for connected device's power status echo 0x40 0x8F > /sys/class/cec/cmd

    To get the response, you can:

    1. read the "registry" cat /sys/class/cec/dump_reg

    2. wait and look for the response in logcat

    // Example:
    02-06 16:33:10.568  4012  4105 D CEC     : [cec_rx_loop]msg:04 90 00
    02-06 16:33:10.570  4012  4105 D HdmiCecExtend: onCecMessageRx
    02-06 16:33:10.657  4012  4012 W HDMI    : [1]:Unhandled cec command:<Report Power Status> src: 0, dst: 4, params: 00
    02-06 16:33:10.762  4012  4104 D CEC     : [cec_send_message][4 -> 0]len:3, body:00 90 00 , result:success
    

    Magic numbers (codes) explanation:

    40 - Playback device #1
    04 - TV device #1
    On - 90 00
    Off - 00 00 // in registry or no response at all in logcat
    

    Other available codes can be constructed or read on Cec-O-Matic or amlogic.

    Chapter III: New hope

    I still have to try and get to Android's HdmiControlService but I still don't know how, probably through Java reflection. You can see HdmiCecExtend: onCecMessageRx so the API is available on the device, but you cannot use it in Android Studio, as far as I know, it's only available to Android TV vendors.

    Will update if anything comes along.

    0 讨论(0)
  • 2021-01-31 21:53

    First of all, very impressive reverse engineering work!

    Secondly, I'm facing a similar issue (but with a non Minix product). Have you tried upgrading to a newer firmware, such as this one:

    http://minixforum.com/threads/x8-x8-plus-x8-h-official-firmware-004a-not-for-x8-h-plus.5567/

    I am suggesting this as a possible solution, because one of the issues it fixes is this:

    Fixed HDMI-CEC multi devices issues

    This means the device is not only a "slave", but also a "master" (i.e. can send commands to other hdmi devices).

    Please note that as stated in the link, it is not intended for the plus version.

    Good luck!

    0 讨论(0)
提交回复
热议问题