有没有办法调节显示器的亮度?

Man*_*d3r 11 brightness monitors

随着时间的推移,使用软按钮很烦人。我的意思是背光的真实亮度(不是 X11 伽玛)。哪些协议可以实现这一点?(DVI,HDMI,DP,猜VGA不是)

小智 14

实际上,只要显卡和显示器都支持显示数据通道,所有这些接口都能够控制背光(以及更多)。

DDC 基于 I²C,因此您必须安装并加载适当的内核模块才能使其工作。

# Debian
sudo apt-get install i2c-tools
sudo modprobe i2c-dev

# RHEL
sudo dnf install i2c-tools
Run Code Online (Sandbox Code Playgroud)

之后,您必须使用 找出连接到显示器的 I²C 总线sudo i2cdetect -l

# Example output for Intel graphics card
i2c-0   i2c         i915 gmbus dpc                      I2C adapter
i2c-1   i2c         i915 gmbus dpb                      I2C adapter
i2c-2   i2c         i915 gmbus dpd                      I2C adapter
i2c-3   i2c         DPDDC-B                             I2C adapter
i2c-4   i2c         DPDDC-C                             I2C adapter

# Example output for AMD graphics card
i2c-0   i2c         Radeon i2c bit bus 0x90             I2C adapter
i2c-1   i2c         Radeon i2c bit bus 0x91             I2C adapter
i2c-2   i2c         Radeon i2c bit bus 0x92             I2C adapter
i2c-3   i2c         Radeon i2c bit bus 0x93             I2C adapter
i2c-4   i2c         Radeon i2c bit bus 0x94             I2C adapter
i2c-5   i2c         Radeon i2c bit bus 0x95             I2C adapter
i2c-6   i2c         card0-eDP-1                         I2C adapter
i2c-7   i2c         card0-VGA-1                         I2C adapter
Run Code Online (Sandbox Code Playgroud)

英特尔的情况下,正确的总线是 DPDDC(显示端口 DDC)之一,具体取决于您使用的端口。在我的情况下,HDMI 和 DP 都显示为 DP。

AMD情况下,总线称为 card0- interface - n

如果没有列出接口,那么您的卡/驱动程序不以标准方式支持 DDC。

现在我们要探查一下,显示器是否支持DDC,是否允许以这种方式设置亮度。首先,安装ddccontrol

# Debian
sudo apt-get install ddccontrol

# RHEL
sudo dnf install ddccontrol
Run Code Online (Sandbox Code Playgroud)

然后,使用它列出支持的 DDC 参数列表。此示例假设您的 DDC 接口绑定到 i2c-3 总线。

# sudo ddccontrol dev:/dev/i2c-3 
ddccontrol version 0.4.2
Copyright 2004-2005 Oleg I. Vdovikin (oleg@cs.msu.su)
Copyright 2004-2006 Nicolas Boichat (nicolas@boichat.ch)
This program comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of this program under the terms of the GNU General Public License.

Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-3...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/DELA0A2.xml"
Document not parsed successfully.
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/DELlcd.xml"
Document not parsed successfully.

EDID readings:
    Plug and Play ID: DELA0A2 [VESA standard monitor]
    Input type: Digital

= VESA standard monitor
> Color settings
    > Brightness and Contrast
        > id=brightness, name=Brightness, address=0x10, delay=-1ms, type=0
          supported, value=45, maximum=100
        > id=contrast, name=Contrast, address=0x12, delay=-1ms, type=0
          supported, value=75, maximum=100
--- [snip] ---
Run Code Online (Sandbox Code Playgroud)

就是这样,如果一切顺利,亮度值应报告与显示器中设置的完全相同的亮度。您现在可以使用此命令设置 50% 的亮度(用上面找到的亮度值地址替换 0x10):

sudo ddccontrol dev:/dev/i2c-3 -r 0x10 -w 50
Run Code Online (Sandbox Code Playgroud)


小智 12

以@M132 的回答为基础,ddccontrol似乎没有维护,并且自 2006 年以来没有为任何新显示器添加配置。

幸运的是,有一个更新的工具:ddcutil,它更加健壮并且开发得更加积极。在安装预构建包之一或从源代码构建后,它可用于查询和设置亮度(以及无数其他设置):

# ddcutil capabilities | grep Brightness
Feature: 10 (Brightness)
# ddcutil getvcp 10
VCP code 0x10 (Brightness                    ): current value =    60, max value =   100
# ddcutil setvcp 10 70
Run Code Online (Sandbox Code Playgroud)


The*_*kin 5

有\xe2 xbacklight\x80\x93“使用RandR扩展调整背光亮度”。

\n\n

然而,我的 HDMI 显示器失败了,所以我转而使用软件修改:

\n\n
xrandr --output HDMI2 --brightness 0.7\n
Run Code Online (Sandbox Code Playgroud)\n


Ste*_*itt 5

DDC / CI内核模块包括ddcci-backlight其可最DDC / CI-能够监视器集成到内核的背光系统模块(/sys/class/backlight)。这允许任何可以使用后者来驱动 DDC/CI 监视器上的背光的工具;例如,使用 GNOME 桌面上的内置控件:

GNOME 桌面的右上角,显示音量和屏幕亮度控制

内核模块在 Debian(自 Debian 9 起)和衍生发行版中可用:

sudo apt install ddcci-dkms
Run Code Online (Sandbox Code Playgroud)