【问题标题】:Turn off TV using cec-client on RPI在 RPI 上使用 cec-client 关闭电视
【发布时间】:2014-11-08 23:08:52
【问题描述】:

我将运行 Raspbian 的 RPi B+ 通过 HDMI 连接到我的 LG 电视。我成功编译并安装了 cec-client,我可以使用命令 echo "on 0" | cec-client -s 轻松打开电视,但是当我尝试使用命令 echo "standby 0" | cec-client -s 关闭电视时,我得到以下输出:

opening a connection to the CEC adapter...
DEBUG:   [             316]     unregistering all CEC clients
DEBUG:   [             318]     Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [             324]     InitHostCEC - vchiq_initialise succeeded
DEBUG:   [             325]     InitHostCEC - vchi_initialise succeeded
DEBUG:   [             326]     InitHostCEC - vchi_connect succeeded
DEBUG:   [             330]     logical address changed to Broadcast (f)
DEBUG:   [             333]     RegisterLogicalAddress - registering address e
DEBUG:   [             605]     logical address changed to Recorder 1 (1)
DEBUG:   [             605]     logical address changed to Free use (e)
DEBUG:   [             605]     Open - vc_cec initialised
NOTICE:  [             605]     connection opened
DEBUG:   [             607]     processor thread started
DEBUG:   [             608]     << Broadcast (F) -> TV (0): POLL
DEBUG:   [             611]     initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [             612]     << e0
DEBUG:   [             647]     >> POLL sent
DEBUG:   [             647]     TV (0): device status changed into 'present'
DEBUG:   [             647]     << requesting vendor ID of 'TV' (0)
TRAFFIC: [             647]     << e0:8c
DEBUG:   [            1858]     expected response not received (87: device vendor id)
TRAFFIC: [            1859]     << e0:8c
DEBUG:   [            3070]     expected response not received (87: device vendor id)
NOTICE:  [            3070]     registering new CEC client - v2.1.4
DEBUG:   [            3070]     detecting logical address for type 'recording device'
DEBUG:   [            3070]     trying logical address 'Recorder 1'
DEBUG:   [            3070]     << Recorder 1 (1) -> Recorder 1 (1): POLL
TRAFFIC: [            3071]     << 11
DEBUG:   [            3071]     UnregisterLogicalAddress - releasing previous logical address
DEBUG:   [            3072]     logical address changed to Broadcast (f)
DEBUG:   [            3073]     RegisterLogicalAddress - registering address 1
DEBUG:   [            3255]     logical address changed to Free use (e)
DEBUG:   [            3255]     logical address changed to Recorder 1 (1)
TRAFFIC: [            3255]     << 11
DEBUG:   [            3255]     >> POLL not sent
DEBUG:   [            3256]     using logical address 'Recorder 1'
DEBUG:   [            3256]     Recorder 1 (1): device status changed into 'handled by libCEC'
DEBUG:   [            3256]     Recorder 1 (1): power status changed from 'unknown' to 'on'
DEBUG:   [            3256]     Recorder 1 (1): vendor = Pulse Eight (001582)
DEBUG:   [            3256]     Recorder 1 (1): CEC version 1.4
DEBUG:   [            3256]     AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
DEBUG:   [            3256]     Recorder 1 (1): osd name set to 'CECTester'
DEBUG:   [            3256]     Recorder 1 (1): menu language set to 'eng'
DEBUG:   [            3258]     GetPhysicalAddress - physical address = 3000
DEBUG:   [            3258]     AutodetectPhysicalAddress - autodetected physical address '3000'
DEBUG:   [            3260]     Recorder 1 (1): physical address changed from ffff to 3000
DEBUG:   [            3262]     << Recorder 1 (1) -> broadcast (F): physical adddress 3000
TRAFFIC: [            3263]     << 1f:84:30:00:01
NOTICE:  [            3415]     CEC client registered: libCEC version = 2.1.4, client version = 2.1.4, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 3.0.0.0, host: armv6l-unknown-linux-gnueabihf, features: 'P8 USB' 'P8 USB detect' 'RPi', git revision: a560d24, compiled on: Sun Sep 14 17:49:41 UTC 2014 by pi@raspberrypi on Linux 3.12.28+ (armv6l)
DEBUG:   [            3415]     << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
TRAFFIC: [            3415]     << 10:47:43:45:43:54:65:73:74:65:72
DEBUG:   [            3716]     << requesting power status of 'TV' (0)
TRAFFIC: [            3716]     << 10:8f
TRAFFIC: [            3868]     >> 01:8c
DEBUG:   [            3868]     >> TV (0) -> Recorder 1 (1): give device vendor id (8C)
DEBUG:   [            3871]     << Recorder 1 (1) -> TV (0): vendor id Pulse Eight (1582)
TRAFFIC: [            3873]     << 1f:87:00:15:82
TRAFFIC: [            4087]     >> 01:90:00
DEBUG:   [            4087]     >> TV (0) -> Recorder 1 (1): report power status (90)
DEBUG:   [            4088]     TV (0): power status changed from 'unknown' to 'on'
DEBUG:   [            4089]     expected response received (90: report power status)
DEBUG:   [            4091]     << requesting vendor ID of 'TV' (0)
TRAFFIC: [            4091]     << 10:8c
TRAFFIC: [            4323]     >> 0f:87:00:e0:91
DEBUG:   [            4323]     >> TV (0) -> Broadcast (F): device vendor id (87)
DEBUG:   [            4323]     TV (0): vendor = LG (00e091)
DEBUG:   [            4323]     << Recorder 1 (1) -> Broadcast (F): vendor id Pulse Eight (1582)
TRAFFIC: [            4323]     << 1f:87:00:15:82
DEBUG:   [            4474]     expected response received (87: device vendor id)
DEBUG:   [            4475]     replacing the command handler for device 'TV' (0)
DEBUG:   [            4478]     TV (0): CEC version 1.3a
DEBUG:   [            4479]     TV (0): menu language set to 'eng'
DEBUG:   [            4481]     Recorder 1 (1): vendor = LG (00e091)
DEBUG:   [            4485]     replacing the command handler for device 'Recorder 1' (1)
DEBUG:   [            4485]     Recorder 1 (1): CEC version 1.3a
NOTICE:  [            4487]     << putting 'TV' (0) in standby mode
TRAFFIC: [            4488]     << 10:36
DEBUG:   [            4552]     unregistering all CEC clients
NOTICE:  [            4555]     unregistering client: libCEC version = 2.1.4, client version = 2.1.4, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 3.0.0.0, host: armv6l-unknown-linux-gnueabihf, features: 'P8 USB' 'P8 USB detect' 'RPi', git revision: a560d24, compiled on: Sun Sep 14 17:49:41 UTC 2014 by pi@raspberrypi on Linux 3.12.28+ (armv6l)
DEBUG:   [            4559]     Recorder 1 (1): power status changed from 'on' to 'unknown'
DEBUG:   [            4561]     Recorder 1 (1): vendor = Unknown (000000)
DEBUG:   [            4564]     Recorder 1 (1): CEC version unknown
DEBUG:   [            4565]     Recorder 1 (1): osd name set to 'Recorder 1'
DEBUG:   [            4567]     Recorder 1 (1): device status changed into 'unknown'
DEBUG:   [            4567]     unregistering all CEC clients
DEBUG:   [            4624]     UnregisterLogicalAddress - releasing previous logical address
DEBUG:   [            4630]     logical address changed to Broadcast (f)

然后什么也没有发生。我也只使用 CLI,过了一段时间 RPi 将电视设置为空白屏幕保护程序,但我无法弄清楚如何在我的命令下立即执行此操作。

【问题讨论】:

  • 我也有同样的问题,希望得到答案。

标签: linux terminal console raspberry-pi raspbian


【解决方案1】:

libCEC 似乎没有什么问题。但是,LG 电视型号的 HDMI-CEC 实现可能只是忽略了待机命令。您应该使用其他一些兼容 HDMI-CEC 的设备测试您的 Raspberry Pi,以检查待机命令是否正常工作。

【讨论】:

    【解决方案2】:

    LG 电视(仅电视)不支持 CEC 待机命令。请参阅 here。不知道是libcec的实现还是TV的限制

    【讨论】:

    • this answer 加强虽然我希望有人仍然可以找到通过 HDMI-CEC 关闭 LG 电视的方法
    【解决方案3】:

    使用这个:

    sudo apt-get update;
    sudo apt-get install gcc;
    sudo apt-get install autoconf;
    sudo apt-get install libtool;
    sudo apt-get install pkg-config;
    sudo apt-get install libselinux1-dev;
    sudo apt-get install liblockdev1-dev;
    sudo apt-get install gawk;
    sudo apt-get install g++;
    sudo apt-get install c++;
    sudo apt-get install libgudev-1.0-dev;
    sudo apt-get install libudev-dev;
    
    mkdir -p $HOME/distr/libcec; 
    wget -P $HOME/distr/libcec https://github.com/Pulse-Eight/libcec/archive/master.zip;
    unzip $HOME/distr/libcec/master.zip -d $HOME/distr/libcec/;
    cd $HOME/distr/libcec/libcec-master ./bootstrap;"
    ./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi;
    make;
    sudo make install;
    sudo apt-get install cec-utils;
    

    然后这个:

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo rpi-update
    sudo reboot
    

    【讨论】:

    • 完成后使用:echo 'standby 0' | cec-client -s
    【解决方案4】:

    这里有一些额外的命令,也许有用...

    待机:

    echo "standby 0" | cec-client -s -d 1
    

    开机:

    echo "on 0" | cec-client -s -d 1
    

    更改 HDMI 源:

    HDMI 1: echo "tx 4F:82:10:00" | cec-client -s -d 1
    HDMI 2: echo "tx 4F:82:20:00" | cec-client -s -d 1
    HDMI 3: echo "tx 4F:82:30:00" | cec-client -s -d 1
    HDMI 4: echo "tx 4F:82:40:00" | cec-client -s -d 1
    

    【讨论】:

      猜你喜欢
      • 2020-02-26
      • 2018-12-20
      • 2013-07-04
      • 1970-01-01
      • 1970-01-01
      • 2017-08-10
      • 1970-01-01
      • 1970-01-01
      • 2021-12-21
      相关资源
      最近更新 更多