13

I have the cec-client and libcec working on my Raspberry Pi. I would like to use it for more than just turning on and off the television, I would like to be able to query the other devices for their system information. Then maybe control them through the RPi. :)

Anyway, I'm wondering if there are some good sources of information on the cec-commands. I know I can send the following:

  • echo "on 0" | cec-client -s to turn on the television
  • echo "standby 0" | cec-client -s to turn it off
  • I even found echo 'lang 0' | cec-client -t p -p 1 -d 1 -s | tail -n1 | grep 'language' | awk '{print $3}' which will tell me the television language is 'eng'.

All of the commands were found in the libcec/support/cec-test-device.sh script. Is there a complete list of built-in libcec commands somewhere?

Alternatively I did look at the CEC-O-MATIC tool. What type of source is the Raspberry Pi or does it matter? Is there a way to query what devices are connected to the television from the RPi? For example, if I connect and disconnect a Blu-ray player, is there a way to tell that has happened?

Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
GrandAdmiral
  • 603
  • 3
  • 8
  • 16

1 Answers1

18

cec-client can tell you the commands it knows

echo h | cec-client -s -d 1

There are a bunch of things that cec can do, that aren't on the list though too. You can press buttons on your remote and see the raw data being passed.

By playing back those same bytes, you can simulate the same functions.

John La Rooy
  • 11,947
  • 9
  • 47
  • 75