I have a Samsung TV / monitor with HDMI, DVI, VGA inputs and more. My Raspberry Pi is connected to the HDMI input, my computer to the DVI input. With

echo as | cec-client -s -d 1

executed on the Pi, I can change the input of the TV to HDMI. As far as I know, DVI does not support CEC. This means I can't execute above command on my computer to make the TV switch to the DVI input.

Is it possible to send a CEC command from the Pi via HDMI to the TV to make it switch to DVI?

  • 1
    Note sure if that is possible. But you could try adding a IR-led to one of the GPIO's and make the Pi send the correct IR command to switch inputs. Look into lirc for this.
    – Gerben
    May 10, 2014 at 9:56

2 Answers 2


You may be able to edit the keymap to cause a certain action to trigger the switch the DVI. You haven't specified which OS you are using, but there's some (limited) guidance on modifying the keymap file for it here. There should be a similar configuration file for other OS's

What I suspect you'll need to do is:

  1. Determine the CEC command for your particular model monitor - to change to DVI;
  2. Then map this to whatever key/button you want.*

Note: My Samsung TV remote doesn't have a single button to switch across. I need to choose source, navigate to the DVI source, then press enter. This might require some script so that a single key press executes several commands in sequence. Though I've never done this, so can't confirm it's possible.


The two ways that may work are:

  1. Determine the command or code to use with User Control Pressed or Vendor Remote Button Down (I'd use CEC-O-MATIC to build the message. You'd need to use the cec-client tx command with what you generate on the site.)
  2. Send the Inactive Source command (is). It is up to the TV manufacturer to decide how the TV reacts to this, but some TVs go back to the previously selected source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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