Bug 79541

Summary: backlight in console changes to minimum when switching from xorg to console
Product: ACPI Reporter: Dmitri (dmitri)
Component: Power-VideoAssignee: Aaron Lu (aaron.lu)
Status: REJECTED INVALID    
Severity: normal CC: aaron.lu
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.15.3-gentoo.2014-07-05_13-00 Subsystem:
Regression: No Bisected commit-id:

Description Dmitri 2014-07-06 01:58:07 UTC
After updating kernel to 3.15.x backlight in console changes to minimum when switching from xorg to console. 

But when switching back from console to xorg, brightness goes back to max as it was before switching. 

Initial boot keeps maximum brightness in console through the boot process. 

Fn+brightness keys (ThinkPad T410) are functional to increase and decrease brightness, both in console and in xorg.

kernel commandline "acpi_backlight=vendor" keeps brightness level the same in console and in xorg, but disable brightness buttons (Fn+Home and Fn+End in my case).

zcat /proc/config.gz | grep -i think 
CONFIG_THINKPAD_ACPI=m 
CONFIG_THINKPAD_ACPI_ALSA_SUPPORT=y 
# CONFIG_THINKPAD_ACPI_DEBUGFACILITIES is not set 
# CONFIG_THINKPAD_ACPI_DEBUG is not set 
CONFIG_THINKPAD_ACPI_UNSAFE_LEDS=y 
CONFIG_THINKPAD_ACPI_VIDEO=y 
CONFIG_THINKPAD_ACPI_HOTKEY_POLL=y

$ zgrep -i fb_backlight /proc/config.gz 
# CONFIG_FB_BACKLIGHT is not set

# lsmod | grep think 
thinkpad_ec             3503  2 hdaps,tp_smapi 
thinkpad_acpi          53325  0

# lsof -r1 /sys/class/backlight/acpi_video0/ 
# lsof -r1 /sys/class/backlight/intel_backlight/ 
# auditctl -w /sys/class/backlight/acpi_video0/ -p war -k blwatch 
# auditctl -w /sys/class/backlight/intel_backlight/ -p war -k blwatch
could not not pinpoint the responsible process

I have started a discussion on http://forums.gentoo.org/viewtopic-t-993600.html and was advised to file a bug report.
Comment 1 Aaron Lu 2014-07-07 01:33:25 UTC
Please list:
# ls /sys/class/backlight

And did you use xorg config file to specify which interface to use?

Please test this:
When you are in X mode, turn on backlight debug message by:
# cd /sys/kernel/debug/dynamic_debug
# echo 'module backlight +pft' > control
Then switch to console mode, check dmesg to see if some program change the backlight level. The dmesg should have something like:
set brightness to
there if some user space tool indeed does this.
Comment 2 Dmitri 2014-07-07 02:46:34 UTC
(In reply to Aaron Lu from comment #1)
> Please list:
> # ls /sys/class/backlight

ls -1 /sys/class/backlight/
acpi_video0
intel_backlight

> 
> And did you use xorg config file to specify which interface to use?

negative, 
xorg.conf has not been created

> 
> Please test this:
> When you are in X mode, turn on backlight debug message by:
> # cd /sys/kernel/debug/dynamic_debug
> # echo 'module backlight +pft' > control
> Then switch to console mode, check dmesg to see if some program change the
> backlight level. The dmesg should have something like:
> set brightness to
> there if some user space tool indeed does this.

I switched back and forth (X->console->X) 
without touching buttons to change brightness
[  179.294484] [3209] brightness_store: backlight: set brightness to 0
[  179.606036] [3209] brightness_store: backlight: set brightness to 15
[  183.627956] [3209] brightness_store: backlight: set brightness to 15


and with brightness correction in console, i have following output
[  391.638419] [3209] brightness_store: backlight: set brightness to 15
[  404.541505] [3209] brightness_store: backlight: set brightness to 0
[  404.859083] [3209] brightness_store: backlight: set brightness to 15
[  409.147188] [3209] brightness_store: backlight: set brightness to 15

In dark console it is not gradual brightness change, rather directly 0->15 on first/single button push, 
however, afterwards, in console gradual brightness does work just fine both ways up and down.
Comment 3 Aaron Lu 2014-07-07 02:49:43 UTC
(In reply to Dmitri from comment #2)
> > Please test this:
> > When you are in X mode, turn on backlight debug message by:
> > # cd /sys/kernel/debug/dynamic_debug
> > # echo 'module backlight +pft' > control
> > Then switch to console mode, check dmesg to see if some program change the
> > backlight level. The dmesg should have something like:
> > set brightness to
> > there if some user space tool indeed does this.
> 
> I switched back and forth (X->console->X) 
> without touching buttons to change brightness
> [  179.294484] [3209] brightness_store: backlight: set brightness to 0
> [  179.606036] [3209] brightness_store: backlight: set brightness to 15
> [  183.627956] [3209] brightness_store: backlight: set brightness to 15

Please check who is process 3209?
Comment 4 Dmitri 2014-07-07 02:52:46 UTC
ps aux | grep 3209
root      3098  0.0  0.0  12380  2260 pts/0    S+   15:51   0:00 grep --colour=auto 3209
root      3209  1.1  0.8 228012 33208 tty7     Ssl+ 15:30   0:15 /usr/bin/X -nolisten tcp -br -deferglyphs 16 vt07 -auth /var/run/slim.auth

aha, thats an Xorg bug actually, wander where i should look to fix it
Comment 5 Dmitri 2014-07-07 03:00:50 UTC
udev is ok
cat /etc/udev/rules.d/81-backlight.rules 
#Set backlight level to 18 [0-15]
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="15"
Comment 6 Dmitri 2014-07-07 03:16:05 UTC
question belongs to Xorg/freedesktop team