How to Control Display Settings Using ddcutil (with examples)
- Linux
- December 17, 2024
The command ddcutil
allows users to manage and configure the settings of connected displays through the Display Data Channel Command Interface (DDC/CI). It provides a powerful way to programmatically adjust display parameters such as brightness, contrast, and more, directly from your command line. The tool requires the i2c-dev
kernel module to be loaded, typically done using modprobe
. This command is invaluable for users who need to automate display configurations or quickly adjust settings without navigating through monitor menus.
Use case 1: Listing All Compatible Displays
Code:
ddcutil detect
Motivation:
Determining which displays are compatible with DDC/CI is essential before attempting to adjust any settings. This command allows users to identify all connected monitors that support DDC/CI, ensuring that adjustments with ddcutil
are applicable. This is the first step in utilizing the power of ddcutil
, as it confirms compatibility and readiness for further actions.
Explanation:
ddcutil
: The base command for interacting with display settings.detect
: This subcommand scans all connected displays and lists those that are compatible with DDC/CI.
Example output:
Display 1
I2C bus: /dev/i2c-4
EDID synopsis:
Mfg id: DEL
Model: U2713HM
Serial number: 123456XYZ
Manufacture year: 2012
EDID version: 1.4
This output indicates that there is one compatible display connected, identified with specific manufacturer details, making it easy to ensure that commands are directed correctly.
Use case 2: Change the Brightness of Display 1 to 50%
Code:
ddcutil --display 1 setvcp 10 50
Motivation:
Manipulating the brightness of a display is a common task that can enhance viewing comfort and reduce eye strain. Setting the brightness to 50% can be particularly useful in changing lighting environments or when transitioning from daylight to evening usage. Automation of this task using ddcutil
can save time and promote consistent visual comfort.
Explanation:
--display 1
: This option specifies the target display by its index, ensuring that changes are applied to the correct screen.setvcp 10 50
: This command tellsddcutil
to set VCP (Virtual Control Panel) option 0x10, which is brightness, to a value of 50%, equating to half of the maximum brightness.
Example output:
Value 0x10 (Brightness) set to 50.
This response confirms the successful adjustment of brightness to the desired level, without needing physical interaction with the monitor’s controls.
Use case 3: Increase the Contrast of Display 1 by 5%
Code:
ddcutil -d 1 setvcp 12 + 5
Motivation:
Enhancing contrast on a display can significantly improve the clarity and definition of images and text. This is particularly useful in scenarios with poor lighting or when higher contrast is needed for specific tasks like photo editing. Incrementally adjusting contrast allows for fine-tuning to achieve the optimal visual output.
Explanation:
-d 1
: A shorthand option equivalent to--display 1
, directing changes to the specified display.setvcp 12 + 5
: This command increases the VCP option 0x12, corresponding to contrast, by an increment of 5%. This allows users to make small adjustments without altering their baseline setup dramatically.
Example output:
Value 0x12 (Contrast) increased by 5 to 55.
The output acknowledges the increase in contrast, with a new setting applied, ensuring the display reflects the modified configuration for better viewing quality.
Use case 4: Read the Settings of Display 1
Code:
ddcutil -d 1 getvcp ALL
Motivation:
Having visibility into all current settings of a display is crucial for diagnosing issues or making informed adjustments. This command provides a comprehensive overview of all configurable parameters for a specific display, enabling users to understand current conditions and potentially identify any inconsistencies or areas for optimization.
Explanation:
-d 1
: This directs the command to focus on display 1, ensuring accuracy in reporting.getvcp ALL
: This command retrieves all VCP (Virtual Control Panel) settings for the specified display, offering a complete picture of how the display is configured at present.
Example output:
VCP code 0x10 (Brightness): current value = 50, max value = 100
VCP code 0x12 (Contrast): current value = 55, max value = 100
...
This detailed output allows users to verify and comprehensively understand all settings on the monitor, paving the way for assessing performance and making further adjustments as required.
Conclusion:
ddcutil
provides a robust suite of functionalities for managing display settings efficiently and programmatically. By utilizing commands to list displays, adjust brightness and contrast, and read current settings, users can significantly enhance their workspaces in a systematic, repeatable fashion. This command-line tool is particularly useful for power users who require precise control over multiple display variables to optimize their visual environment.