2013-03-09 879 views
2

我的總體規劃是能夠從我的樹莓派發送CEC命令來執行諸如打開/關閉電視以及連接到電視的其他設備等事情。然後,我將添加語音識別來發送這些命令......這是另一天。我已經閱讀了CEC,但從我收集的內容看來,如果沒有CEC USB適配器,您不能直接通過命令行發送CEC命令?我在我的pi上安裝了cec-client和libCEC庫,但是當我運行cec-client -l時,它不顯示任何設備。通過HDMI通過命令行發送CEC命令

我的問題是,如何在沒有適配器的情況下通過命令行向我的電視發送CEC命令?我錯過了關於CEC的一些基本元素?

UPDATE

除了下面這裏的職位是要求其中有一個我已經把我的.bashrc內打開電視/關閉一些CEC命令計算器的PI部分的鏈接和改變輸入

https://raspberrypi.stackexchange.com/questions/5345/raspmbc-send-cec-commands-without-cec-adapter

+1

我不知道這是否是對你有用的提取,但也許這是一個起點點。 [libCEC](https://github.com/Pulse-Eight/libcec) – ManuelSchneid3r 2013-03-10 11:40:16

回答

3

最近libcec的版本將識別樹莓派的硬件作爲CEC適配器。
要通過命令行發送控制命令,基本上是:

echo "on 0" | cec-client -s 

將開機設備0(即電視)的更復雜的命令

+1

當前cec-client註銷所有活動的CEC監聽器。執行此命令後,Kodi會丟失與HDMI網絡的連接。 – 2016-04-11 20:26:59

1

可以通過管道
退房CEC的客戶端交互的shell命令於CEC客戶端二進制

echo "on 0"  | cec-client -s # turn on the television 
echo "standby 0" | cec-client -s # turn it off (standby) 

爲了完整起見,這些都是一些其他的東西,你可以做

列表連接設備

tv# cec-client -l 
libCEC version: 3.1.0, git revision: libcec-3.1.0+5-6d68d21, compiled on Fri 8 Apr 15:44:58 UTC 2016 by [email protected] on Linux 4.1.19-v7+ (armv7l), features: P8_USB, DRM, P8_detect, randr, RPi 
Found devices: 1 

device:    1 
com port:   RPI 
vendor id:   2708 
product id:   1001 
firmware version: 1 
type:    Raspberry Pi 

檢查所有可用的CEC命令

tv# echo h | cec-client -s -d 1 
opening a connection to the CEC adapter... 

================================================================================ 
Available commands: 

[tx] {bytes}    transfer bytes over the CEC line. 
[txn] {bytes}    transfer bytes but don't wait for transmission ACK. 
[on] {address}   power on the device with the given logical address. 
[standby] {address}  put the device with the given address in standby mode. 
[la] {logical address} change the logical address of the CEC adapter. 
[p] {device} {port}  change the HDMI port number of the CEC adapter. 
[pa] {physical address} change the physical address of the CEC adapter. 
[as]      make the CEC adapter the active source. 
[is]      mark the CEC adapter as inactive source. 
[osd] {addr} {string}  set OSD message on the specified device. 
[ver] {addr}    get the CEC version of the specified device. 
[ven] {addr}    get the vendor ID of the specified device. 
[lang] {addr}    get the menu language of the specified device. 
[pow] {addr}    get the power status of the specified device. 
[name] {addr}    get the OSD name of the specified device. 
[poll] {addr}    poll the specified device. 
[lad]      lists active devices on the bus 
[ad] {addr}    checks whether the specified device is active. 
[at] {type}    checks whether the specified device type is active. 
[sp] {addr}    makes the specified physical address active. 
[spl] {addr}    makes the specified logical address active. 
[volup]     send a volume up command to the amp if present 
[voldown]     send a volume down command to the amp if present 
[mute]     send a mute/unmute command to the amp if present 
[self]     show the list of addresses controlled by libCEC 
[scan]     scan the CEC bus and display device info 
[mon] {1|0}    enable or disable CEC bus monitoring. 
[log] {1 - 31}   change the log level. see cectypes.h for values. 
[ping]     send a ping command to the CEC adapter. 
[bl]      to let the adapter enter the bootloader, to upgrade 
          the flash rom. 
[r]      reconnect to the CEC adapter. 
[h] or [help]    show this help. 
[q] or [quit]    to quit the CEC test client and switch off all 
          connected CEC devices. 
================================================================================ 

https://ownyourbits.com/2017/02/02/control-your-raspberry-pi-with-your-tv-remote/