You are not logged in.

#1 2015-10-30 13:00:54

ghorvath
Member
Registered: 2015-10-01
Posts: 142

[SOLVED] screen has max brightness after login after lock

I am not sure if this is a bug or not, but it certainly bothers me. I let xfce4-power-manager handle the backlight settings. If I lock the screen, log back in, then screen brightness is set to maximum, no matter what setting it was on before. However, if I press Fn+screen brightness up or down, then screen brightness will be old brightness+-1, i.e. then xfce4-power-manager takes over brightness again. I can reproduce it both on AC power and on battery, and it happens also when the screen is locked because of idle state. Is it possible that lightdm and xfce4-power-manager fight when logging in after a lock-screen? How could I make sure xfce4-power-manager is the winner in such a fight?

Last edited by ghorvath (2015-11-01 01:57:28)

Offline

#2 2015-10-30 13:10:30

damo
....moderator....
Registered: 2015-08-20
Posts: 6,258

Re: [SOLVED] screen has max brightness after login after lock

Do you have the power management set in your autostart? Eg

## Enable power management
xfce4-power-manager &

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2015-10-30 14:45:25

hhh
Meep!
Registered: 2015-09-17
Posts: 10,471
Website

Re: [SOLVED] screen has max brightness after login after lock

I haven't experienced this, but I've been installing our backported xfce4-power-manager and ditching fdpowermon as a systray icon.

Offline

#4 2015-10-30 15:36:30

ghorvath
Member
Registered: 2015-10-01
Posts: 142

Re: [SOLVED] screen has max brightness after login after lock

damo wrote:

Do you have the power management set in your autostart? Eg

## Enable power management
xfce4-power-manager &

Yes. And it is running. It is interesting, though. It should set the brightness to 1% after 60 seconds of inactivity, and should turn off the screen after 2 minutes of inactivity. It never set the brightness to 1% but it did in fact turn the screen off after 2 minutes. And the whole time it "thought" (by right-clicking on the tint-icon) that brightness is down.

hhh wrote:

I haven't experienced this, but I've been installing our backported xfce4-power-manager and ditching fdpowermon as a systray icon.

I also installed the backported version (without xfce4-power-manager-plugins, but I also tried it with that installed, made no difference), and purged fdpowermon.

Offline

#5 2015-10-30 15:44:05

hhh
Meep!
Registered: 2015-09-17
Posts: 10,471
Website

Re: [SOLVED] screen has max brightness after login after lock

So this is probably a hardware issue, which is almost impossible to troubleshoot unless someone has the same hardware to test on. Post your computer model/specs and maybe something will turn up.

Offline

#6 2015-10-30 15:58:40

ghorvath
Member
Registered: 2015-10-01
Posts: 142

Re: [SOLVED] screen has max brightness after login after lock

My laptop is a Samsung series 9 NP900X3C with Hungarian keyboard. :-) I installed everything in CSM BIOS mode (UEFI mode install can brick the laptop, and the samsung-laptop kernel module is blacklisted then) using the RC1 ISO. Everything works properly, I can set brightness with the keys, and if I do not lock the screen, then the brightness is always set correctly by xfce4-power-manager, and I can even set brightness manually via dpms. It is only when logging in after locking the screen.

Oh, just so we are clear: by locking the screen, I mean SUPER+L. That is, I am still logged in, but the screen is black, and I need a password to get back to my session again. So autostart should not run (again), because it already has when I first logged in, and all programs (e.g. xfce4-power-manager) are still running in the background. It really looks as if lightdm takes over this one time to set the brightness, and xfce4-power-manager does not realize it.

I also have laptop-mode-tools installed which should put brightness to 1% when on battery, but somehow I doubt that this is the problem. Laptop-mode-tools also seems to work properly.

I have a Toshiba laptop, as well. Later I will check if that has the same problem or not.

Edit: I checked and my Toshiba laptop does not seem to exhibit this buggy behaviour. It works as it is supposed to. Weird.

Last edited by ghorvath (2015-10-30 18:48:39)

Offline

#7 2015-10-31 00:50:59

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: [SOLVED] screen has max brightness after login after lock

It is likely something to do with light-locker. Someone here should know how to get your screen lock pointed back to xscreensaver and see if that resolves the issue. I haven't really messed with it much, tbh. If it doesn't work, then I generally purge it.

Offline

#8 2015-10-31 07:31:05

ghorvath
Member
Registered: 2015-10-01
Posts: 142

Re: [SOLVED] screen has max brightness after login after lock

I do not want to purge it, I want to fix it. Somehow xscreensaver did not work well with vlc-player.

Anyhow, I figured out part of the problem. There are _two_ places where one can set the brightness:

/sys/class/backlight/intel_backlight/brightness
/sys/class/backlight/acpi_video0/brightness

The first one is the raw version, can go from 0 to 4650 (only 4648 for me), the second one is the firmware one, can go from 0 to 100. If I set the firmware, then it sets the raw one almost proportionally, as well, except if I want to set it to the same amount as it is currently. I.e. if the firmware one is on 50 and I want to set it on 50, then it does not do anything with the raw version.

Further, setting the raw one does not change the firmware setting, at all. Therefore everything is fine as long as every program only changes the firmware file, instead of the raw one. I checked and the Fn keys, xfce4-power-manager and laptop-mode-tools all change the firmware file. However, when logging back in after screen lock, I checked the files, and the raw one was set to max, the firmware was on the setting it was previously. Therefore, there must be some other program at login which changes only the raw file to max. I am just not entirely sure how to find this program....

Edit: Ok, this is a kernel issue. If I boot the 3.16 kernel, then everything is fine. If I boot the backported 4.2 kernel, then I have this problem. In fact something must have changed between these two kernel versions and lcd brightness handling. With kernel 3.16 setting the firmware file to 0 resulted  231 in the raw file (about 5 %), as if firmware -5 would be the 0 point for the raw. Now setting the firmware file to 5 already sets raw to 0. In fact, setting firmware to 10 would set raw to 231. And indeed, if I set the firmware file such a way that the raw file still has positive value, then the bug is not happening.

Who do you think I should report this kernel problem?

Last edited by ghorvath (2015-10-31 08:43:45)

Offline

#9 2015-10-31 11:48:47

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: [SOLVED] screen has max brightness after login after lock

ghorvath wrote:

If I boot the 3.16 kernel, then everything is fine. If I boot the backported 4.2 kernel, then I have this problem. In fact something must have changed between these two kernel versions and lcd brightness handling.

There has been a change in the way the kernel handles backlights from version 4 onwards.
https://git.kernel.org/cgit/linux/kerne … 8247f15e8a

For the stock BL kernel (version  3.16), try this kernel parameter:

video.use_native_backlight=1

For kernel versions >4, try the parameters listed here:
https://wiki.archlinux.org/index.php/Ba … ne_options


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#10 2015-10-31 15:28:24

hhh
Meep!
Registered: 2015-09-17
Posts: 10,471
Website

Re: [SOLVED] screen has max brightness after login after lock

I'm cleaning up this forum so I can prioritize our issues. You're not using the stock kernel, so I'm moving this to Kernel & Hardware. Thanks!

Offline

#11 2015-10-31 23:42:02

ghorvath
Member
Registered: 2015-10-01
Posts: 142

Re: [SOLVED] screen has max brightness after login after lock

Finally, I managed to do it. For kernel 4.2 I needed to use

acpi_backlight=native

as a kernel parameter. I put this into /etc/default/grub, because kernel 3.16 would simply ignore it, anyway. Then there is only the raw file where the brightness can be controlled. I wrote this script to help me deal with both situations at the same time, if anyone is interested:

#!/bin/bash
FIRMWARE_file="/sys/class/backlight/acpi_video0/brightness"
RAW_file="/sys/class/backlight/intel_backlight/brightness"
RAW_max_file="/sys/class/backlight/intel_backlight/max_brightness"
if [ -f $FIRMWARE_file ]
then
  FIRMWARE_brightness="$(cat $FIRMWARE_file)"
elif [ -f $RAW_file ] && [ -f $RAW_max_file ]
then
  RAW_brightness="$(cat $RAW_file)"
  RAW_max_brightness="$(cat $RAW_max_file)"
  # this is how kernel 4.2 decreases brightness using Fn+F2
  RAW_new_brightness="$(($RAW_max_brightness-$RAW_max_brightness/10*(100-$1)/10))"
  #RAW_new_brightness="$(($RAW_max_brightness-$RAW_max_brightness/100*(100-$1)))"
  #RAW_new_brightness="$(($RAW_max_brightness-$RAW_max_brightness*(100-$1)/100))"
  #RAW_new_brightness="$(($RAW_max_brightness/100*$1))"
  #RAW_new_brightness="$(($RAW_max_brightness*$1/100))"
else
  echo "Did not find video backlight brightness or max_brightness files."
  exit 1
fi
case $1 in
  [0-9]|[1-9][0-9]|100)
    # just to make really sure that $1 is an integer between 0 and 100
    if [ "$1" -ge 0 ] && [ "$1" -le 100 ]
    then
      if [ -f $FIRMWARE_file ]
      then
        if [ "$1" == "$FIRMWARE_brightness" ]
        then
          # 6 is the minimum amount that changes the RAW value for kernel 4.2
          if [ "$1" == 6 ]
          then
            echo "7" > $FIRMWARE_file
            echo "$1" > $FIRMWARE_file
          else
            echo "6" > $FIRMWARE_file
            echo "$1" > $FIRMWARE_file
          fi
        else
          echo "$1" > $FIRMWARE_file
        fi
      else
        echo "$RAW_new_brightness" > $RAW_file
      fi
    else
      echo "Usage, as root: $(basename $0) [0-100]"
      if [ -f $FIRMWARE_file ]
      then
        echo "Current status: $FIRMWARE_brightness"
      else
        echo "Current status: $((100*$RAW_brightness/$RAW_max_brightness))"
      fi
    fi
    ;;
  *)
    echo "Usage, as root: $(basename $0) [0-100]"
    if [ -f $FIRMWARE_file ]
    then
      echo "Current status: $FIRMWARE_brightness"
    else
      echo "Current status: $((100*$RAW_brightness/$RAW_max_brightness))"
    fi
    ;;
esac

I put this into /usr/local/sbin/samsung_lcd, and the usage is

samsung_lcd percentage

to set the brightness to percentage % of the maximum value.

Offline

#12 2015-11-01 00:33:28

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: [SOLVED] screen has max brightness after login after lock

Good work ghorvath -- thanks for posting the solution.

Please add "[SOLVED]" to the thread title for the benefit of others wink


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

Board footer

Powered by FluxBB