Skip to content

Write brightness to all raw devices

On some laptops, there are multiple enabled raw backlight devices, and backlighthelper can't choose right device.

For example: nvidia optimus laptop, Lenovo 15ARH05. It has two GPUs AMD and NVIDIA, both of them provide their backlight device, both backlight devices are raw type and enabled(in case prime is used). Backlighthelper without this fix selects NVIDIA device for backlight, but on this laptop brightness is controlled by AMD gpu, so user can't control brightness.

This fix implements additional list for all raw devices. This list is loaded on initUsingBacklightType. List contains pairs of sysfs path and max brightness of device. When brightness is changed, backlighthelper goes through entries starting from second(first device is written by data from m_dirname) and writes brightness with correcting difference between max_brightness in different devices. For all other cases(read brightness and other) first raw device is used.

BUG: 399646

Merge request reports