Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
laptop display brightness control and laptop power savings?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
kokyu
n00b
n00b


Joined: 22 Dec 2011
Posts: 13

PostPosted: Wed Jan 04, 2012 11:54 am    Post subject: laptop display brightness control and laptop power savings? Reply with quote

hey all,

last time I installed Gentoo on my netbook, I was able to change display back-light brightness (Acer Laptop with intel GPU).

Now, I'm having a new Laptop, but since then, I cannot change its LCD back-light brightness, which I highly need to save power consumption while traveling. :)
I do not know what package I might be missing.
I'm using KDE desktop (and it's power management UI)

Any ideas what I can do?
What package/configuration might I be missing to be able to make use of KDE's (display!) power management features?

Thanks in advance,
Kokyu.
Back to top
View user's profile Send private message
sebaro
Veteran
Veteran


Joined: 03 Jul 2006
Posts: 1141
Location: Romania

PostPosted: Wed Jan 04, 2012 3:35 pm    Post subject: Reply with quote

For backlight:
> grep BACKLIGHT /boot/config
For power savings:
> grep ACPI /boot/config
Make sure you have both enabled.
Back to top
View user's profile Send private message
kokyu
n00b
n00b


Joined: 22 Dec 2011
Posts: 13

PostPosted: Wed Jan 04, 2012 3:40 pm    Post subject: Reply with quote

ah. a very interesting point, yes. many thanks so far.

the following is for backlight, and I seem to have already enabled as much as possible within that section.
Code:
windsor [~] > zgrep BACKLIGHT /proc/config.gz
CONFIG_FB_BACKLIGHT=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GENERIC=y
# CONFIG_BACKLIGHT_PROGEAR is not set
# CONFIG_BACKLIGHT_APPLE is not set
# CONFIG_BACKLIGHT_SAHARA is not set
CONFIG_BACKLIGHT_ADP8860=y
CONFIG_BACKLIGHT_ADP8870=y
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
CONFIG_DRM_NOUVEAU_BACKLIGHT=y


Code:
windsor [~] > zgrep ACPI /proc/config.gz
CONFIG_X86_64_ACPI_NUMA=y
# Power management and ACPI options
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_PROCFS=y
CONFIG_ACPI_PROCFS_POWER=y
# CONFIG_ACPI_EC_DEBUGFS is not set
CONFIG_ACPI_PROC_EVENT=y
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_FAN=y
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_PROCESSOR_AGGREGATOR=y
CONFIG_ACPI_THERMAL=y
CONFIG_ACPI_NUMA=y
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
CONFIG_ACPI_PCI_SLOT=y
CONFIG_ACPI_CONTAINER=y
CONFIG_ACPI_SBS=y
CONFIG_ACPI_HED=y
# CONFIG_ACPI_CUSTOM_METHOD is not set
CONFIG_ACPI_APEI=y
CONFIG_ACPI_APEI_GHES=y
# CONFIG_ACPI_APEI_PCIEAER is not set
# CONFIG_ACPI_APEI_MEMORY_FAILURE is not set
CONFIG_ACPI_APEI_EINJ=y
CONFIG_ACPI_APEI_ERST_DEBUG=y
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_HOTPLUG_PCI_ACPI=y
# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
CONFIG_PNPACPI=y
CONFIG_ATA_ACPI=y
# CONFIG_PATA_ACPI is not set
# ACPI drivers
# ACPI drivers
# CONFIG_SENSORS_ACPI_POWER is not set
# CONFIG_ACPI_QUICKSTART is not set
# CONFIG_THINKPAD_ACPI is not set
CONFIG_ACPI_WMI=m
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_TOSHIBA is not set
# CONFIG_ACPI_CMPC is not set

for acpi the same, but I guess the CONFIG_ACPI_ASUS might be relevant, too, since it's an Asus laptop.

Thanks so far,
kokyu.
Back to top
View user's profile Send private message
sebaro
Veteran
Veteran


Joined: 03 Jul 2006
Posts: 1141
Location: Romania

PostPosted: Thu Jan 05, 2012 3:27 pm    Post subject: Reply with quote

I can't help you with the ACPI/power savings part. But for gamma correction and brightness/backlight you can try x11-apps/xgamma and x11-apps/xbacklight.
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Thu Jan 05, 2012 3:55 pm    Post subject: Reply with quote

See if you have controls in /sys/class/backlight . There should be a file named "brightness" in one of the subdirectories, and writing numbers to it should change the brightness.

If no such control exists or it has no effect, then something is wrong with your kernel still.
Back to top
View user's profile Send private message
kokyu
n00b
n00b


Joined: 22 Dec 2011
Posts: 13

PostPosted: Thu Jan 05, 2012 4:21 pm    Post subject: Reply with quote

chithanh wrote:
See if you have controls in /sys/class/backlight . There should be a file named "brightness" in one of the subdirectories, and writing numbers to it should change the brightness.

If no such control exists or it has no effect, then something is wrong with your kernel still.


aha. That's it. many thanks.

this is the output:
Quote:
laptop ~ # /bin/ls -lh /sys/class/backlight/
total 0
lrwxrwxrwx 1 root root 0 Jan 5 10:13 acpi_video0 -> ../../devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
lrwxrwxrwx 1 root root 0 Jan 5 10:14 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card1/card1-LVDS-1/intel_backlight

laptop ~ # /bin/ls -lh /sys/class/backlight/*/brightness
-rw-r--r-- 1 root root 4.0K Jan 5 17:11 /sys/class/backlight/acpi_video0/brightness
-rw-r--r-- 1 root root 4.0K Jan 5 17:12 /sys/class/backlight/intel_backlight/brightness

laptop ~ # cat /sys/class/backlight/acpi_video0/brightness
4
laptop ~ # cat /sys/class/backlight/intel_backlight/brightness
900


Writing to intel_backlight/brightness (value between 0..999) works, however, setting the value in acpi_video0/brightness (0..9, default 4) then it is ignored.

I assume that KDE's power management is just trying to set the first instead of the intel_backlight/brightness then and I could consider this a bug in either KDE (using the wrong backlight controller) or the kernel (ignoring my writes to acpi_video0/brightness) then... hmmmm :(

Cheers,
Kokyu.

p.s.: edit: yep. tested it. changing the acpi_video0/brightness value by hand reflects the GUI settings in KDE's battery panel.
Back to top
View user's profile Send private message
B-Man
Retired Dev
Retired Dev


Joined: 30 Jan 2012
Posts: 1

PostPosted: Mon Jan 30, 2012 2:42 am    Post subject: Reply with quote

kokyu wrote:
chithanh wrote:
See if you have controls in /sys/class/backlight . There should be a file named "brightness" in one of the subdirectories, and writing numbers to it should change the brightness.

If no such control exists or it has no effect, then something is wrong with your kernel still.


aha. That's it. many thanks.

this is the output:
Quote:
laptop ~ # /bin/ls -lh /sys/class/backlight/
total 0
lrwxrwxrwx 1 root root 0 Jan 5 10:13 acpi_video0 -> ../../devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
lrwxrwxrwx 1 root root 0 Jan 5 10:14 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card1/card1-LVDS-1/intel_backlight

laptop ~ # /bin/ls -lh /sys/class/backlight/*/brightness
-rw-r--r-- 1 root root 4.0K Jan 5 17:11 /sys/class/backlight/acpi_video0/brightness
-rw-r--r-- 1 root root 4.0K Jan 5 17:12 /sys/class/backlight/intel_backlight/brightness

laptop ~ # cat /sys/class/backlight/acpi_video0/brightness
4
laptop ~ # cat /sys/class/backlight/intel_backlight/brightness
900


Writing to intel_backlight/brightness (value between 0..999) works, however, setting the value in acpi_video0/brightness (0..9, default 4) then it is ignored.

I assume that KDE's power management is just trying to set the first instead of the intel_backlight/brightness then and I could consider this a bug in either KDE (using the wrong backlight controller) or the kernel (ignoring my writes to acpi_video0/brightness) then... hmmmm :(

Cheers,
Kokyu.

p.s.: edit: yep. tested it. changing the acpi_video0/brightness value by hand reflects the GUI settings in KDE's battery panel.


I have found the same issue on my laptop. Any luck in fixing this? I have found a few other bug reports with KDE that support was added but no luck getting it to work yet.
Back to top
View user's profile Send private message
ultraslinky
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jun 2011
Posts: 80
Location: Milan, Italy

PostPosted: Mon Jan 30, 2012 10:19 am    Post subject: Reply with quote

Have you tried using xbacklight? I'm in your situation, the ACPI backlight control only works for maximum and minimum brightness and the only way to change the brightness is xbacklight or writing to the file in /sys.
Back to top
View user's profile Send private message
kokyu
n00b
n00b


Joined: 22 Dec 2011
Posts: 13

PostPosted: Wed Feb 01, 2012 10:01 am    Post subject: Reply with quote

nope, did not try xbacklight, I'd rather like to see KDE being fixing that (power management on hybrid graphics laptops).

I wrote I tiny script to aid my "mobile"-mode :)

Code:

#! /bin/bash

MAX_BRIGHTNESS=$(cat /sys/class/backlight/intel_backlight/max_brightness)

if [[ "$1" == "reset" ]]
then
        CPU_SCALING_GOVENOR=performance
        BRIGHTNESS=$MAX_BRIGHTNESS
        POWER_POLICY=max_performance
else
        CPU_SCALING_GOVENOR=ondemand
        BRIGHTNESS=$[MAX_BRIGHTNESS * 10 / 100]
        POWER_POLICY=min_power
fi

cvar() {
        echo "$1 = $2" && echo $2 > $1
}

cvar /sys/class/backlight/intel_backlight/brightness $BRIGHTNESS

for prefix in /sys/devices/system/cpu/cpu?; do
        cvar $prefix/cpufreq/scaling_governor $CPU_SCALING_GOVENOR
done

for prefix in /sys/class/scsi_host/host?; do
        cvar $prefix/link_power_management_policy $POWER_POLICY
done


be aware, in that (personal) script, I access the brightness of my intel_backlight card, as this is, what I only use (had no success with my secondary NVIDIA card on it yet) - you may want to adjust it.

I run this script once I start working mobile (e.g. having no external power cable connected), and run it again with the "reset" parameter passed as soon as I am back stationary (with power cable plugged in) :)

hope this script is inspiring :)
Kokyu.
Back to top
View user's profile Send private message
dachschaden
n00b
n00b


Joined: 07 Jun 2014
Posts: 65
Location: Germany

PostPosted: Sun Jun 22, 2014 3:24 am    Post subject: Reply with quote

I know that this thread is about two years old, but like I give a fuck ... also non-native english speaker/writer, cut me some slack.

I got the same problem as the OP with XFCE4. The difference is that I am a programer and debugger, and thus I was able to find out some very interesting informations concerning this problem.
First, the directories in /sys/class/backlight named like "acpi_videoX" are activated by the ACPI_VIDEO switch, documented in Documentation/acpi/video_extension.txt.

Well, OK, that isn't true, because the switch isn't mentioned ONCE in the document.
And: I cannot turn it off, for reasons involving quantum mechanics and what <Insert name of the guy who's responsible for the module> had for lunch last friday.

Is it only me, or are there people who would support my theory that the idiots programming the kernel are autists which expect other to follow their weird logic? THIS is exactly the reason why linux won't launch off on the desktop - even Microsoft isn't that incompetent. I, as a user, do not care how much work you put into your module, if it does not work and trying to fix the problem involves reading kernel documentation someone - and it's NOT me - is doing something terribly wrong (and that coming from someone who uses Gentoo as main OS ...)

OK, but I am programmer, so I am supposed to have lower standards ... I mean, hey, I can read code, so I am destined to do it, right?
By chance I found out that the /sys/class/backlight/-directory gets populated by drivers/acpi/video.c, currently in acpi_video_dev_register_backlight, line 1661. (version 3.15).
Let's ignore the fact that the code is horrifying enough to cause me nightmares if I'd ever sleep, and just insert a "return;" at the beginning of the function, recompile and reboot ...

Code:

# ls -lah /sys/class/backlight/
insgesamt 0
drwxr-xr-x  2 root root 0 22. Jun 04:58 .
drwxr-xr-x 33 root root 0 22. Jun 04:58 ..
lrwxrwxrwx  1 root root 0 22. Jun 2014  intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight


Well, OK. I know have just one backlight object, and setting the brightness file changes my screen brightness as well. Everything's allright.
Except for the little fact that all user space applications which are supposed to give me access to my screen brightness think that there is no access to it.

At this point I would have downloaded the source of xfce4-brightness-plugin, my program which even now shamelessly lies in my face that it cannot access my backlight, but for another reasons including the color of the eye shade of mister programmer's missus as well as the amount of helium present in the sun (not to mention the very important reasons above) the Gentoo developers decided that THIS VERY PACKAGE wouldn't be named after the name of the program it manages, so it's not available for separate emerging, ebuilding and you-know-what. If you expect me to debug stuff, make it easy or die trying.
And THIS is the very reason why I think that we need some sort of coder licence, in contrast to a driver licence. If you can't do it, you get your licence voided. At least one licence would have been revoked this morning just for my problem.

Enough rant. I will just leave this here - I have spent enough of my lifetime debugging this crap. I found a workaround, it's not nice, but at least it works, it makes my kernel smaller, and I can feel smug about people who screw up IT infrastructure.
Whoever wants to annoy all the programmers at the window manager teams to death has enough ammunition for this now. Make'em suffer. ;)

So long,
dachschaden.

PS: After another session of thinking about the problem I decided to fool all broken user space programs by symlinking to a acpi_video0 directory - but sysfs has no support for this. OK, my bad.
So I just edited the name of the device to register from "intel_backlight" to "acpi_video0" in drivers/gpu/drm/i915/intel_panel.c, intel_backlight_device_register, in line 876.

Code:

# ls -lah /sys/class/backlight/
insgesamt 0
drwxr-xr-x  2 root root 0 22. Jun 13:37 .
drwxr-xr-x 33 root root 0 22. Jun 13:37 ..
lrwxrwxrwx  1 root root 0 22. Jun 2014  acpi_video0 -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/acpi_video0


It worked - that is, the renaming of the device.
But my user space tools still cannot adjust the brightness, and now I am not sure who is in fault for this. On one hand I can set the screen brightness manually, on the other one the directory is now named as I'd suppose they expect it to be.

I am a bit ... well, how do they put it in english ... flabbergasted.

Oh, Xorg recognizes the device just fine:

Quote:

Xorg.0.log:[ 14.123] (--) intel(0): found backlight control interface /sys/class/backlight/acpi_video0


One thing was setting me off, though:

Quote:

Jun 22 13:37:37 asgard kernel: [ 2.221335] asus_wmi: Backlight controlled by ACPI video driver


I am using an ASUS laptop, and the asus_wmi support is compiled into the kernel (for fancy things like, well, illuminated keys on my keyboard - which do not work in Gentoo, but in Kali with the very same kernel, but that's another story).
The point is, this message comes from drivers/platform/x86/asus-wmi.c, asus_wmi_add. But since ACPI is broken on my laptop as well - and noone seems to care, except for the nouveau guys (but they couldn't help me there and referred me to the freedesktop.org guys who just seem to try to sit it dead).

I am giving up here. And for all the others out there with problems concerning the backlight: Either use the interface already described here to set your brightness, or annoy the dudes who programmed the infrastructure to death. I have invested already too much of my lifetime trying to debug shit from people who clearly should never have programmed anything.
Back to top
View user's profile Send private message
feniksa
n00b
n00b


Joined: 03 May 2015
Posts: 7
Location: Ukraine

PostPosted: Sat Nov 26, 2016 12:26 pm    Post subject: Reply with quote

Go to kernel:

# cd /usr/src/linux

Device Drivers -> x86 Platform Specific Drivers -> WMI

You should DISSABLE WMI support, for ASUS laptop it doesn't works.

After recompile of kernel and update, backlight control should work.

Thanks for help in this thread
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum