Software-control a Dell monitor KVM from Linux

       698 words, 4 minutes

I own a DELL U2723QE 4K monitor that ships with a KVM so that I can connect two computers. One via an USB-c connection and one via either an HDMI or a DisplayPort connector. Switch to either is controlled by a physical button on the back of the screen. But it can also be done software-wise.

Not long ago, I learned from @janamarie@mystical.garden that one can use the DDCutil to control the monitor from a Linux system. The two commands they pointed out were the only one required to switch to USB-C or HDMI.

Still, using them on Slackware Linux requires few extra steps.

Compile DDCutil

Building the software is described on their website . On a Slackware system, it goes like this:

# wget https://www.ddcutil.com/tarballs/ddcutil-2.2.1.tar.gz
# tar xvzf ddcutil-2.2.1.tar.gz
# cd ddcutil-2.2.1
# autoreconf --force --install
# ./configure
# make

Load the i2c kernel module to be able to communicate with the monitor.

# doas /sbin/modprobe i2c-dev

Explore the hardware

The detect argument allows displaying what’s connected and recognized.

# doas ./src/ddcutil detect
Invalid display
   I2C bus:  /dev/i2c-5
   DRM_connector:           card0-eDP-1
   EDID synopsis:
      Mfg id:               AUO - UNK
      Model:
      Product code:         9277  (0x243d)
      Serial number:
      Binary serial number: 0 (0x00000000)
      Manufacture year:     2017,  Week: 0
   This is a laptop display.  Laptop displays do not support DDC/CI.

Display 1
   I2C bus:  /dev/i2c-7
   DRM_connector:           card0-DP-2
   EDID synopsis:
      Mfg id:               DEL - Dell Inc.
      Model:                DELL U2723QE
      Product code:         17017  (0x4279)
      Serial number:        xxxxxxx
      Binary serial number: 0000000000 (0xaaaaaaaa)
      Manufacture year:     2023,  Week: 34
   VCP version:         2.1

More details about the monitor can be displayed using:

# doas ./src/ddcutil capabilities
Model: U2723QE
MCCS version: 2.1
Commands:
   Op Code: 01 (VCP Request)
   Op Code: 02 (VCP Response)
   Op Code: 03 (VCP Set)
   Op Code: 07 (Timing Request)
   Op Code: 0C (Save Settings)
   Op Code: E3 (Capabilities Reply)
   Op Code: F3 (Capabilities Request)
VCP Features:
   Feature: 02 (New control value)
   Feature: 04 (Restore factory defaults)
   Feature: 05 (Restore factory brightness/contrast defaults)
   Feature: 08 (Restore color defaults)
   Feature: 10 (Brightness)
   Feature: 12 (Contrast)
   Feature: 14 (Select color preset)
      Values:
         01: sRGB
         04: 5000 K
         05: 6500 K
         06: 7500 K
         08: 9300 K
         09: 10000 K
         0b: User 1
         0c: User 2
   Feature: 16 (Video gain: Red)
   Feature: 18 (Video gain: Green)
   Feature: 1A (Video gain: Blue)
   Feature: 52 (Active control)
   Feature: 60 (Input Source)
      Values:
         1b: Unrecognized value
         0f: DisplayPort-1
         11: HDMI-1
   Feature: AA (Screen Orientation)
      Values:
         01: 0 degrees
         02: 90 degrees
         04: 270 degrees
   Feature: AC (Horizontal frequency)
   Feature: AE (Vertical frequency)
   Feature: B2 (Flat panel sub-pixel layout)
   Feature: B6 (Display technology type)
   Feature: C6 (Application enable key)
   Feature: C8 (Display controller type)
   Feature: C9 (Display firmware level)
   Feature: CC (OSD Language)
      Values:
         02: English
         03: French
         04: German
         06: Japanese
         09: Russian
         0a: Spanish
         0d: Chinese (simplified / Kantai)
         0e: Portuguese (Brazil)
   Feature: D6 (Power mode)
      Values:
         01: DPM: On,  DPMS: Off
         04: DPM: Off, DPMS: Off
         05: Write only value to turn off display
   Feature: DC (Display Mode)
      Values:
         00: Standard/Default mode
         03: Movie
         05: Games
   Feature: DF (VCP Version)
   Feature: E0 (Manufacturer specific feature)
   Feature: E1 (Manufacturer specific feature)
   Feature: E2 (Manufacturer specific feature)
      Values: 00 02 04 0C 0D 0F 10 11 13 0B 1B 1A 14 23 24 27 3A (interpretation unavailable)
   Feature: E5 (Manufacturer specific feature)
   Feature: E7 (Manufacturer specific feature)
      Values: 02 03 (interpretation unavailable)
   Feature: E8 (Manufacturer specific feature)
   Feature: E9 (Manufacturer specific feature)
      Values: 00 01 02 21 22 24 (interpretation unavailable)
   Feature: EA (Manufacturer specific feature)
   Feature: EF (Manufacturer specific feature)
   Feature: F0 (Manufacturer specific feature)
      Values: 00 05 06 09 0A 31 32 34 36 (interpretation unavailable)
   Feature: F1 (Manufacturer specific feature)
   Feature: F2 (Manufacturer specific feature)
   Feature: FE (Manufacturer specific feature)
   Feature: FD (Manufacturer specific feature)

Control the monitor

To switch the OSD language to either English or French, use one of those commands:

# doas ./src/ddcutil -d 1 setvcp 0xCC 0x02
# doas ./src/ddcutil -d 1 setvcp 0xCC 0x03

To switch the KVM to HDMI, use:

# doas ./src/ddcutil -d 1 setvcp 0x60 0x11

To switch the KVM to USB-C, use:

# doas ./src/ddcutil -d 1 setvcp 0x60 0x1b

Thanks again Jana for pointing me to this tool!