You are not logged in.

#1 2012-09-20 19:33:49

tetsuo41
Member
Registered: 2012-09-20
Posts: 4

[SOLVED]Problem with backlight set to 100% after boot (gnome 3).

Hi everybody,

I have a problem with gnome 3 forcing my backlight brightness to 100% at each boot, despite the fact I'm forcing brightness value in /sys during boot.
I've searched in this forum and g**gled a lot, but can't find anyone having similar issue.

My laptop is an HP Elitebook 8440p. It embeds a Nvidia gfx controller (and I'm using Nvidia proprietary driver)
Fn keys for backlight control are working fine out of the box.

Let me detail the issue:
- As gnome 3 is unable to store the brightness value from boot to boot (looks to be a known issue of gnome 3?), I've workaround it by forcing the brightness to desired value by "echoing" it to /sys during boot in rc.local (or using tmpfiles.d, both giving same result):

$ echo 6 > /sys/class/backlight/acpi_video0/brightness

- If I boot in console mode (no gdm), this is working as expected: after boot, brightness level is 6 and I can use Fn keys to adjust it.
- If I boot in console mode (no gdm) and just start X (running xclock for example), this is also working as expected: in X, brightness level is 6 and I can use Fn keys to adjust it.
- If I start gdm, brightness is increased to 100%.

Once in gnome-shell with full backlight brightness, if I check the backlight brightness in /sys, I get:

$ cat /sys/class/backlight/acpi_video0/brightness
$ 6

But clearly, the real brightness level of the display is not 6!!! (but probably 24, which is the max value).
Then, if I echo 6 in the /sys/.../brightness again, the backlight is decreased to the correct value. Same thing if I press the Fn key: brightness value suddenly decrease to the correct value (doesn't step to 23 but rather to a value close to 6).

I've tried several tricks I've found in this forum and in the wiki, but with no success:
- adding

acpi_osi=Linux acpi_backlight=legacy

to kernel parameters doesn't change anything.
- adding 

acpi_osi=Linux acpi_backlight=vendor

to kernel parameters just break the Fn keys but doesn't change anything else.
- adding brighntess control to nvidia drivers in /etc/X11/xorg.conf.d/20-nvidia.conf

Option "RegistryDwords" "EnableBrightnessControl=1"

doesn't change anything either.
- trying to play with xbacklight doesn't work. When called, xbacklight doesn't answer with any error, doesn't answer anything either, and doesn't change the backlight brightness at all.

In /sys/class/backlight/acpi_video0/ there is other files like "bl_power" (write) and "actual_brightness" (read only). "actual_brightness" always reflect the value as in  /sys/.../brightness. Even when the backlight is obviously at 100%, it tells me 6. "bl_power" seems to have no effect.

My conclusions of all those experiments make me think that:
- It doesn't looks to be HW related. HW is working (Fn keys ok, /sys control of brightness ok).
- It doesn't looks to be related to X server (it's ok with X without gnome).
- It is coming from something inside or started by gdm/gnome 3.

So, two questions come to my mind:
1. Who in gdm/gnome is pushing my backlight brightness to 100% at each boot?
2. Why the hell do I read 6 in /sys/class/backlight/acpi_video0/brightness when it is clearly higher than this on screen?

There is still the option of writing a script started by gdm to echo the correct value in /sys, but this is not elegant and I would prefer to understand what is really happening here (this is one of the reason why I choose Arch: to have the control of my system and understand how it works).

Thank you for any suggestion that could help me!!

Last edited by tetsuo41 (2012-09-24 19:42:18)

Offline

#2 2012-09-23 18:12:56

don_crissti
Member
Registered: 2009-03-17
Posts: 35

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

This is because gnome-settings-daemon overrides your settings, so all your scripts are rendered useless once you login. In order to preserve backlight settings across reboots you should do the following:
Once in Gnome, adjust brightness as per your taste using Fn keys then open a terminal and run:

/usr/lib/gnome-settings-daemon/gsd-backlight-helper --get-brightness

That should return a number corresponding to the brightness level you've just set (e.g. 6). Then run:

gnome-session-properties

then Add a new startup program -- enter a name (e.g. brightnessctrl) and the following command:

pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper --set-brightness 6

where 6 is the number you got from the first command. Now brightness settings should stick across reboots.

Offline

#3 2012-09-24 19:41:12

tetsuo41
Member
Registered: 2012-09-20
Posts: 4

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

Thank you don_crissti!

This is working fine. I'm tagging this post as [SOLVED].
This still doesn't explain who is increasing the backlight or why the value read from /sys/.../backlight is not good after gnome start (gsd-backlight-helper gives same value as in /sys by the way), but at least I'm not stuck anymore!

Thank you for the trick, I hope this helps someone else too!

Offline

#4 2012-09-25 14:39:14

Haikarainen
Member
Registered: 2012-09-04
Posts: 90

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

This might be of help if you would like to debug it further:

https://bbs.archlinux.org/viewtopic.php?id=149408

Offline

#5 2012-09-25 18:26:37

tetsuo41
Member
Registered: 2012-09-20
Posts: 4

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

Thank you Haikarainen.

Nice script!
This actually does the same thing I was doing, writing brightness value in /sys/class/backlight/ device.
My concern was more about finding who is changing my brightness since I only have one device in /sys/class/backlight/  and the value in it is always reflecting actual brightness, except after gnome boot.

Offline

#6 2013-01-28 10:08:19

cee
Member
From: 47.214409, 7.538438
Registered: 2013-01-28
Posts: 1

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

Hi, guys

I was wondering, if there is also a simple solution for this backlight issue on XFCE.
Fn Keys work fine and I am able to set backlight with: 'xbacklight = 40%'.

What I tried is a systemd script that is executed on login. That did not work. (Sorry for not examining the root cause of *why* it is not working)

don_crissti's solution for gnome seems very clean. Is there something similar for XFCE?
Just as an idea, I would like to save the current backlight level on shutdown and restore the same level on boot if possible.

Offline

#7 2014-08-15 08:06:43

user1391
Member
Registered: 2014-01-29
Posts: 7

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

I am encountering the same issue.

I don't know if it's GDM, but when logging out or shutting down, brightness gets set to 100%.

systemd-backlight.@service still saves the value, but that doesn't help, since the value is already wrong when the service fires.

I don't really want to hack around the problem, but would like to find out what actually causes this.
Any idea for further investigations?

Edit: Same issue with lxdm.

Last edited by user1391 (2014-08-15 14:01:38)

Offline

#8 2014-08-18 00:38:40

abennett
Member
Registered: 2014-08-18
Posts: 7

Re: [SOLVED]Problem with backlight set to 100% after boot (gnome 3).

I am also interested in an XFCE solution.

Offline

Board footer

Powered by FluxBB