12

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?

15

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.

  • 1
    The echo scan | cec-client -s -d 1 command was exactly what I was looking for to query what devices are connected to the television. I also wasn't using the "-d 1" option before... that's a big improvement! – GrandAdmiral Aug 23 '13 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.