Hi all, I recently faced an interesting conundrum of having to connect a Macbook Pro and an Ubuntu desktop to the same monitor (Dell U3417W). I had to switch the monitor input source from Mac to Ubuntu and vice-versa frequently and the only way to do so was to physically press a bunch of buttons on the monitor. This got cumbersome pretty quickly and I wanted to find a niftier solution. I was already using the same keyboard and mouse to control both using synergy, so I started digging around and this post describes my findings.
Table of Contents
My google search led to me to a linux program named ddccontrol which lets one control monitor parameters like brightness, contrast, input source, RGB color levels etc.
Once I had connected both Mac (HDMI-2) and Ubuntu desktop (DisplayPort-2) to the same monitor, it was time to play with the tool. I installed ddccontrol on the Ubuntu using below command.
Once installed, you'll need to probe I2C devices to find monitor buses. In my case, /dev/i2c-3 was the device corresponding to my Dell monitor.
In order to change the input source, we first need to find the control value of the monitor input source setting. You can find this by running below command.
Caveat: If the grep fails, take a look at the raw output.
The above output indicates that 0x60 is the monitor input source control value.
In order to change the input source, we need to write the corresponding input source value to the control. You can use the table listed below to find the correct value. In my case, since my Mac was on HDMI-2, I had to write 18.
|Composite video 1||5|
|Composite video 2||6|
|Component video (YPrPb/YCrCb) 1||12|
|Component video (YPrPb/YCrCb) 2||13|
|Component video (YPrPb/YCrCb) 3||14|
Unfortunately, ddccontrol is built for Linux distributions and doesn't work on Mac. However, there is an equivalent tool that provides similar functionality titled ddcctl. You can install it by running below commands.
The above command installs ddcctl to /usr/local/bin/ddcctl directory. You can run ddcctl on command line to list all the options it supports.
ddcctl is not as feature reach as ddccontrol but it gets the job done. Since I only had one external display connected, the display value was 1. My Ubuntu desktop is connected to DisplayPort-2, so I had to pass 16 as per above table to change my input source.