https://bugs.kde.org/show_bug.cgi?id=381199

            Bug ID: 381199
           Summary: Broken brightness control with kernel module (ex.
                    nvidia-bl)
           Product: Powerdevil
           Version: 5.10.0
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: plasma-devel@kde.org
          Reporter: vsnrain....@gmail.com
  Target Milestone: ---

Overview:
Since 5.10, it is no longer possible to adjust brightness on my system, which
requires special kernel module for brightness to work. I tried to look at what
caused this, and found that in following commit 
https://cgit.kde.org/powerdevil.git/commit/?id=86c3548d103ff5966366788220796de629be9230
Was attempt to add feature that powerdevil will control only brightness of
active device. Part of relevant code is following:

/daemon/backends/upower/backlighthelper.cpp
bool BacklightHelper::isRawBacklightEnabled(const QString &interface)
{
    QFile file(BACKLIGHT_SYSFS_PATH + interface + "/device/enabled");

    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        return false;
    }

    QByteArray buffer = file.readLine().trimmed();
    if (buffer == "enabled") {
        return true;
   }

    return false;
}

As you can see, it was implemented by skipping all brightness devices which in
BACKLIGHT_SYSFS_PATH + interface + "/device/enabled" does not return "enabled".
The problem is, there is no property "device/enabled" in my nvidia_backlight
device:

ls -la /sys/class/backlight/nvidia_backlight/                  
total 0
drwxr-xr-x 3 root root    0 Jun  2 22:50 .
drwxr-xr-x 3 root root    0 Jun  2 22:50 ..
-r--r--r-- 1 root root 4096 Jun  2 23:02 actual_brightness
-rw-r--r-- 1 root root 4096 Jun  2 23:02 bl_power
-rw-r--r-- 1 root root 4096 Jun  2 22:54 brightness
-r--r--r-- 1 root root 4096 Jun  2 22:50 max_brightness
drwxr-xr-x 2 root root    0 Jun  2 23:02 power
lrwxrwxrwx 1 root root    0 Jun  2 22:50 subsystem ->
../../../../class/backlight
-r--r--r-- 1 root root 4096 Jun  2 22:50 type
-rw-r--r-- 1 root root 4096 Jun  2 22:50 uevent

so powerdevil tries to open this file, fails, and always skips this brightness
device. I recompiled powerdevil with "return true" in mentioned function, and
brightness control works again, so it seems that problem in indeed in this
part.

Steps to Reproduce:
use kernel module for brightness device, tested on Nvidia GF 9400M with
nvidia-bl kernel module.

Actual Results:
powerdevil always skips brightness device, because it cannot open file
/sys/class/backlight/nvidia_backlight/device/enabled, which does not exist.

Expected Results:
register and control brightness device.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to