Using ddcutil on Pop!_OS With Nvidia Drivers
I recently installed System76’s Pop!_OS on my desktop computer, which uses an Nvidia GeForce GTX 1660 SUPER. The Nvidia support from Pop!_OS is great, and it’s a wonderfully polished Linux distro, but I ran into an issue using ddcutil, a utility to adjust the brightness of external monitors.
I spent a lot of time on this, but the fix is very simple.
TLDR
Run these commands:
sudo mkdir /etc/X11/xorg.conf.d
sudo vim /etc/X11/xorg.conf.d/10-ddcutil-nvidia.conf
Add this text:
Section "Device"
Driver "nvidia"
Identifier "Dev0"
Option "RegistryDwords" "RMUseSwI2c=0x01; RMI2cSpeed=100"
EndSection
Restart your computer. Done!
The Issue
I installed ddcutil using the following instructions (for Pop!_OS 20.04 LTS), which are linked to from the official ddcutil install page:
echo 'deb http://download.opensuse.org/repositories/home:/rockowitz/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/home:rockowitz.list
curl -fsSL https://download.opensuse.org/repositories/home:rockowitz/xUbuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home:rockowitz.gpg > /dev/null
sudo apt update
sudo apt install ddcutil ddccontrol
Then, after running ddcutil detect
, and running into an error, I ran ddcutil environment
, and granted my user access to /dev/i2c-N
devices using the i2c-tools
package. After running ddcutil again, I received the following message:
Configuration suggestions:
Current user has RW access to all /dev/i2c-N devices.
Skipping further group and permission checks.
Then I ran ddcutil detect
again, which again resulted in an error, so the problem clearly wasn’t solved. I then poked around a bit, and tried to apply ddcutil’s recommended Nvidia fixes, which are as follows:
Per this discussion, adding the following to the “Device” section for the Nvidia driver resolves the problem for some cards:
A file for making this change is 90-nvidia_i2c.conf located in distribution directory data/etc/X11/xorg.conf.dOption "RegistryDwords" "RMUseSwI2c=0x01; RMI2cSpeed=100"
Copy this file to /etc/X11/xorg.conf.dSection "Device" Driver "nvidia" Identifier "Dev0" Option "RegistryDwords" "RMUseSwI2c=0x01; RMI2cSpeed=100" # solves problem of i2c errors with nvidia driver # per https://devtalk.nvidia.com/default/topic/572292/-solved-does-gddccontrol-work-for-anyone-here-nvidia-i2c-monitor-display-ddc/#4309293 EndSection
The problem is, on my Pop!_OS system, none of these files or directories existed.
The Fix
Thanks to a helpful comment comment in the Pop!_OS subreddit, I figured out that I had to create these directories manually. Then, I ran:
sudo mkdir /etc/X11/xorg.conf.d
sudo vim /etc/X11/xorg.conf.d/10-ddcutil-nvidia.conf
And added this text:
# Solution pulled from https://www.reddit.com/r/pop_os/comments/brki3v/unable_to_open_x_config_file_for_editing_nvidia/eoey2dr/ and http://www.ddcutil.com/nvidia/, via https://blog.slm.space/2020/ddcutil-on-pop-os/ | September 2020
Section "Device"
Driver "nvidia"
Identifier "Dev0"
Option "RegistryDwords" "RMUseSwI2c=0x01; RMI2cSpeed=100"
# solves problem of i2c errors with nvidia driver
# per https://devtalk.nvidia.com/default/topic/572292/-solved-does-gddccontrol-work-for-anyone-here-nvidia-i2c-monitor-display-ddc/#4309293
EndSection
After restarting my computer, I was able to run ddccontrol commands without issue. For an example command, to adjust the brightness of an external display, run sudo ddccontrol -p
to detect available displays. Then, if your display is available at dev:/dev/i2c-3
, run sudo ddccontrol dev:/dev/i2c-3 -r
. You’ll get something that looks like this:
= VESA standard monitor
> Color settings
> Brightness and Contrast
> id=brightness, name=Brightness, address=0x10, delay=-1ms, type=0
supported, value=4, maximum=100
> id=contrast, name=Contrast, address=0x12, delay=-1ms, type=0
supported, value=57, maximum=100
If you want to adjust the brightness of this monitor to 50/100, run:
sudo ddccontrol dev:/dev/i2c-3 -r 0x10 -w 50
Once you have ddccontrol working via the command line, I recommend that you install a GUI for ddccontrol by running sudo apt-get install gddccontrol
. The app will then show up in your application drawer as “DDC Control”.
If none of this fixes your issues, check that:
- Your monitor has DDC/CI support, and
- DDC/CI is enabled in your monitor.
Strangely, fixing this ddcutil issue also seemed to fix the issue of GNOME’s “Night Light” feature not working properly with dual monitors (see on Ask Ubuntu or GNOME’s Bugzilla). Since implementing this change, the “Night Light” has automatically shifted itself on and off on both monitors.