After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 649423 - Save and restore screen backlight state between reboots
Save and restore screen backlight state between reboots
Status: RESOLVED NOTGNOME
Product: gnome-settings-daemon
Classification: Core
Component: power
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Richard Hughes
gnome-settings-daemon-maint
: 649424 661586 682213 699102 699939 709632 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-05 00:55 UTC by Mao Jianjun
Modified: 2013-10-16 20:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A simple patch for gpm-backlight.c (1.22 KB, patch)
2011-05-06 06:02 UTC, Mao Jianjun
none Details | Review

Description Mao Jianjun 2011-05-05 00:55:31 UTC
I set the backlight brightness through keyboard shortcut or "System setting -> Screen ->Brightness" menu, but after I relogin or rerun the gnome-power-manager, the brightness will be set to maximum level. So gnome-power-manager don't save or retore my settings. And When I check the "Dim screen to save power" option, dim works well, but it retores the brightness to maximum level as well. So is this a bug? (version 3.0.0)
Comment 1 Fabio Durán Verdugo 2011-05-05 01:14:33 UTC
*** Bug 649424 has been marked as a duplicate of this bug. ***
Comment 2 Mao Jianjun 2011-05-06 06:02:56 UTC
Created attachment 187338 [details] [review]
A simple patch for gpm-backlight.c
Comment 3 Mao Jianjun 2011-05-06 06:03:31 UTC
Comment on attachment 187338 [details] [review]
A simple patch for gpm-backlight.c

Eh, I was frustrated about the brightness problem, so I make a patch myself. Now it works "better" I think~ 
But only solve the problem that everytime starting gnome-power-manager and then it will reset the brightness to maximum level.

Some details and my suggestion: 
In gpm-backlight.c the gpm_backlight_init function initialize the master_percentage value to someting associate with macro GPM_SETTINGS_BRIGHTNESS_AC, which means the value of master_percentage is 100. And my solution is getting current brightness level first and then set new brightness level to it. And I do think it's better to restore brightness level set by users, but not a maximum level.
Comment 4 Martin Pitt 2012-01-23 17:47:20 UTC
This is handled by gnome-settings-daemon's power plugin now, moving. Also retitling to match the bug description more closely.
Comment 5 Martin Pitt 2012-01-23 17:47:56 UTC
Comment on attachment 187338 [details] [review]
A simple patch for gpm-backlight.c

Obsoleting patch, as the power plugin code is quite different. E. g. right now it does not store the current brightness anywhere.
Comment 6 Bastien Nocera 2012-01-23 19:08:40 UTC
*** Bug 661586 has been marked as a duplicate of this bug. ***
Comment 7 Richard Hughes 2012-02-01 13:34:56 UTC
Right, at the moment the brightness level is restored if you have a color profile that describes a certain luminance. I also think we should just set the old user brightness on new login.
Comment 8 Jason Simanek 2012-04-28 13:21:11 UTC
Just wanted to chime in to say that I am also affected by this bug. I am using a color profile for my display.

Wouldn't the logical approach be to allow the user's brightness setting to override the color profile settings? Anybody that needs color accuracy should be smart enough to know that they'll need to turn their brightness all the way up for color-sensitive work.

Maybe that behavior is what Mr. Hughes is referring to as the "old user brightness", so please excuse my comment if it is redundant with his.
Comment 9 Bastien Nocera 2012-08-20 09:18:06 UTC
*** Bug 682213 has been marked as a duplicate of this bug. ***
Comment 10 Janne Uusitalo 2012-09-03 08:03:20 UTC
Sorry for the empty message I fear some of you received some moments ago. It seems the 'commit' button below CC List wasn't for subscribing to the CC List :|

Anyway, I'm also affected by this bug and hope it will be fixed soon. A related problem (worth another report, probably, but I haven't checked whether one already exists) is that the function keys for setting screen brightness do not work, which significantly adds to the irritation.
Comment 11 Bastien Nocera 2013-01-17 20:58:00 UTC
*** Bug 688706 has been marked as a duplicate of this bug. ***
Comment 12 Conley Moorhous 2013-04-30 16:46:42 UTC
I have the same problem that Janne has. My brightness is not saved, and the brightness function keys only go from maximum down one click, or back to maximum. If I turn the brightness down in settings and then use the function keys, the brightness goes back to maximum. Additionally, if I turn the brightness down in power settings and then go back to the main settings panel, and then go back to power settings, the brightness goes back to maximum.
Comment 13 Mantas Kriaučiūnas 2013-05-13 06:03:06 UTC
It's very important to save and restore screen backlight brightness level between reboots - there are some laptops, where brightness are set to minimum after reboot and users must go to system settings and set brightness to needed level every day :(
This problem is reported in Redhat and Ubuntu bug tracking systems and lots of people are affected by this bug, see for example:

https://launchpad.net/gnome-settings-daemon/+bug/896595

41 people affected and about 10 duplicated bugs reported!

Is it so hard to save and restore screen backlight brightness level between reboots using gsettings?
AFAIK it's trivial operation for any GNOME/GTK programmer, or I'm not right?
Comment 14 collura 2013-07-26 10:24:15 UTC
forgetful brightness across reboots 
is still a problem in 
gnome 3.8 (gnome-settings-daemon-3.8.4-1.fc19.x86_64 of fedora19)
(downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=696621)

the following bugs possibly related/duplicated:

  https://bugzilla.gnome.org/show_bug.cgi?id=649423 dup?
  https://bugzilla.gnome.org/show_bug.cgi?id=667054 dup?
  https://bugzilla.gnome.org/show_bug.cgi?id=699102 dup?
  https://bugzilla.gnome.org/show_bug.cgi?id=699939 related?
Comment 15 Bastien Nocera 2013-07-26 11:02:22 UTC
*** Bug 699939 has been marked as a duplicate of this bug. ***
Comment 16 Bastien Nocera 2013-07-26 11:02:33 UTC
*** Bug 699102 has been marked as a duplicate of this bug. ***
Comment 17 Bastien Nocera 2013-07-26 11:34:11 UTC
(In reply to comment #13)
<snip>
> Is it so hard to save and restore screen backlight brightness level between
> reboots using gsettings?
> AFAIK it's trivial operation for any GNOME/GTK programmer, or I'm not right?

You're not right. There's no session running when you turn off your laptop, and you don't want the brightness to change when changing users, or switching from the login screen to the session. So it's far from trivial which is why it's not implemented yet.
Comment 18 Pacho Ramos 2013-07-26 17:15:10 UTC
(In reply to comment #17)
> You're not right. There's no session running when you turn off your laptop, and
> you don't want the brightness to change when changing users, or switching from
> the login screen to the session. So it's far from trivial which is why it's not
> implemented yet.

Wouldn't be possible to simply save the brightness value chosen by each user (and default to 100% as fallback)?
Comment 19 hehe_br 2013-08-29 18:38:45 UTC
(In reply to comment #17)
> (In reply to comment #13)
> <snip>
> > Is it so hard to save and restore screen backlight brightness level between
> > reboots using gsettings?
> > AFAIK it's trivial operation for any GNOME/GTK programmer, or I'm not right?
> 
> You're not right. There's no session running when you turn off your laptop, and
> you don't want the brightness to change when changing users, or switching from
> the login screen to the session. So it's far from trivial which is why it's not
> implemented yet.

Hi everyone, I do hope linux to be more user friendly!
So, I've been following the bug for a while and I have a suggestion:
My work around for the problem is to use xbacklight on start up (xbacklight -set 10). While reading the last comments and making use of xbacklight I was thinking if it is possible to create a configuration file which collects the data from users and different sessions when brightness is changed and saves it to a configuration file and reads it again for new logons. For example if a user changes the brightness, it automatically save its value associated with that user on the configuration file, while if not changed the system follows could follow a standard setting.
The configuration file could be something like this:
(I will use xbacklight because I don't know which command you use to set brightness just for purposes of illustrating what I want to say!)

%Brightness settings 
IF user not listed below set brightness to standard
IF use is listed follow configuration set for that user
%Users or sessions
login screen > xbacklight -set 100
root > xbacklight -set 100
User1 > xbacklight -set 50
User2 > xbacklight -set 10 

My idea is that if a user change the value of brightness, the system should save this data in this configuration file associated with his login, and when the system is loading the system reads this and sets what was previously set.

Sorry if I'm sounding too simple, I just want to help. If it does not work maybe it can give some ideas to solve this problem!
Thanks for your help and attention!
Comment 20 Bastien Nocera 2013-09-04 20:27:47 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > You're not right. There's no session running when you turn off your laptop, and
> > you don't want the brightness to change when changing users, or switching from
> > the login screen to the session. So it's far from trivial which is why it's not
> > implemented yet.
> 
> Wouldn't be possible to simply save the brightness value chosen by each user
> (and default to 100% as fallback)?

No, because it would be crap. We don't change brightness when logging in, we don't change brightness when logging out.
Comment 21 Bastien Nocera 2013-10-08 12:21:39 UTC
*** Bug 709632 has been marked as a duplicate of this bug. ***
Comment 22 Bastien Nocera 2013-10-11 07:58:32 UTC
systemd >= 207 saves and restores display backlights.

This patch should allow us to do the same for keyboard backlights:
https://bugs.freedesktop.org/show_bug.cgi?id=70367
Comment 23 Dixon Xavier 2013-10-12 07:08:11 UTC
Sorry to ask,
how can i apply the patch ?
Comment 24 André Klapper 2013-10-12 10:41:29 UTC
(In reply to comment #23)
> how can i apply the patch ?

Please ask in a support forum of your distribution, this is out of scope for this bugtracker. Thanks.
Comment 25 Envel 2013-10-16 19:05:31 UTC
(In reply to comment #20)
> (In reply to comment #18)
> > (In reply to comment #17)
> > > You're not right. There's no session running when you turn off your laptop, and
> > > you don't want the brightness to change when changing users, or switching from
> > > the login screen to the session. So it's far from trivial which is why it's not
> > > implemented yet.
> > 
> > Wouldn't be possible to simply save the brightness value chosen by each user
> > (and default to 100% as fallback)?
> 
> No, because it would be crap. We don't change brightness when logging in, we
> don't change brightness when logging out.

I am sorry, but could you please explain why storing brightness separately for each user is 'crap'? Changing the brightness is impossible before login (such as  in lightdm, laptop hardware keys for brightness change don't work). You mean that someone can harm the user by setting minimal brightness (even zero) and switch off the laptop? It will be hard to login in this case after reboot.
Comment 26 Bastien Nocera 2013-10-16 20:53:15 UTC
(In reply to comment #25)
<snip>
> I am sorry, but could you please explain why storing brightness separately for
> each user is 'crap'? Changing the brightness is impossible before login (such
> as  in lightdm, laptop hardware keys for brightness change don't work).

GNOME doesn't use lightdm, and gdm supports the brightness keys just fine.

> You
> mean that someone can harm the user by setting minimal brightness (even zero)
> and switch off the laptop? It will be hard to login in this case after reboot.

No, because we don't want the brightness changing when you do fast-user switching, when logging in or logging out.