You are not logged in.

#1 2013-01-06 13:39:43

wabi
Member
Registered: 2005-04-04
Posts: 61

[SOLVED] Thinkpad X220 configure default screen brightness at startup

At startup (Gnome 3) my Thinkpad X220 reduces the screen brightness to the minimum.
The Fn-Keys work and I can make it brighter with pressing the correct keyboard combination but I'd like to have a slightly brighter default setting when it starts.

I use TLP for the power management and that does not have a screen brightness default setting in /etc/defaults/tlp.

Where can I set this?

Last edited by wabi (2013-01-08 20:51:53)

Offline

#2 2013-01-07 01:43:07

matteotom
Member
Registered: 2012-12-01
Posts: 7

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

you can change the screen brightness by echoing a number from 0 to 15 to /sys/class/backlight/acpi_video0/brightness.

echo 12 > /sys/class/backlight/acpi_video0/brightness

as root should do the trick.  If you have more than one screen you can use

for i in /sys/class/backlight/acpi_video*/brightness; do echo 0 > $i; done

Add that somewhere where it will be executed at boot or login, and you should be good to go.

Offline

#3 2013-01-07 01:48:43

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

Use a tmpfile (/etc/tmpfiles.d).  This is what seems to be the general concensus as the "correct" way to go about it.

Offline

#4 2013-01-07 19:46:06

wabi
Member
Registered: 2005-04-04
Posts: 61

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

created the following file in /etc/tmpfiles.d/

-rw-r--r-- 1 root root 56 Jan  7 20:35 screen_brightness.conf

with the following content:

w /sys/class/backlight/acpi_video0/brightness - - - - 6

Unfortunatley it does not seem to work.


echo 6 > /sys/class/backlight/acpi_video0/brightness
works perfectly if executed as root.

What am I doing worng?

Offline

#5 2013-01-07 20:32:08

matteotom
Member
Registered: 2012-12-01
Posts: 7

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

Maybe try

w /sys/class/backlight/acpi_video0/brightness 644 root root - 6

or

w /sys/class/backlight/acpi_video0/brightness 644 root root - '6'

(difference is the 6 is in quotes in the second one)

Offline

#6 2013-01-08 15:52:14

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,010
Website

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

Probably Gnome sets the brightness on its own, rendering the setting done with systemd useless. I do not use Gnome and while the file you have posted is almost the same on my x220, it works as intended here.
w /sys/class/backlight/acpi_video0/brightness - - - - 8
I suggest you to boot to the commandline and check if the brightness is set correctly if you do not start Xorg.

Offline

#7 2013-01-08 17:29:45

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

You know, I don't think this is the "right" way to do it, but I had trouble with a tmpfile not consistently setting the brightness on boot.  So I tried a udev rule and it works consistently.

So your machine might be slightly different, but I think you can get the idea.  This is what my rule contains:

# cat /etc/udev/rules.d/45-backlight.rules
ACTION=="add", KERNEL=="acpi_video0", SUBSYSTEM=="backlight", SUBSYSTEMS=="pci", DRIVERS=="i915", ATTR{brightness}="2"

Of course you have to adjust for the brightness level.  My machine (Thinkpad Edge E430) goes from 1 to 15 in acpi_video0, and as indicated by my "DRIVERS==", I use integrated Intel graphics.

I can't remember why I chose 45 for the filename, but I remember there was a reason.  You may want to change that aspect.

Offline

#8 2013-01-08 20:53:01

wabi
Member
Registered: 2005-04-04
Posts: 61

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

Thanks. The udev rule works after some adjustments. I could name the file simply backlight.rules, no 45 required.

Offline

#9 2013-01-09 00:23:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

Yes, this is true.  But the udev rules in /usr/lib/udev/rules.d follow a lexicographical order.   So the numbers are there to determine the order in which they are run.  By using simply "backlight.rules" it is run after all the numbered rules. 

But if it works, then thats great!  Just know that the naming has significance if you ever start making rules for other things.

Offline

#10 2013-01-26 23:17:05

nardev
Member
Registered: 2013-01-26
Posts: 2

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

WonderWoofy wrote:

You know, I don't think this is the "right" way to do it, but I had trouble with a tmpfile not consistently setting the brightness on boot.  So I tried a udev rule and it works consistently.

So your machine might be slightly different, but I think you can get the idea.  This is what my rule contains:

# cat /etc/udev/rules.d/45-backlight.rules
ACTION=="add", KERNEL=="acpi_video0", SUBSYSTEM=="backlight", SUBSYSTEMS=="pci", DRIVERS=="i915", ATTR{brightness}="2"

Of course you have to adjust for the brightness level.  My machine (Thinkpad Edge E430) goes from 1 to 15 in acpi_video0, and as indicated by my "DRIVERS==", I use integrated Intel graphics.

I can't remember why I chose 45 for the filename, but I remember there was a reason.  You may want to change that aspect.

Only result i get from this is that computer boots up with very low brightness.

What ever value (1 to 15) i try to write in /sys/class/backlight/acpi_video0/brightness  nothing changes.

And, external monitor doesn't change at all. It's constantly very bright.

Any idea how to fix this?

It's T430 thinkpad with nvidia driver.

Offline

#11 2013-01-28 00:03:01

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

I believe the external monitor is actually not able to be dimmed or brightened from the system itself.  I may be totally wrong here, but I think you actually have to use the brightness settings on your monitor.

As far as the low brightness, you may have to be using the other brightness file in /sys/class/backlight.  There are typically two directories there and both control some separate element of brightness.  For instance, I have acpi_video0 which goes from 1 to 15 and I have intel_backlight which was set at 4880 when I just checked.  I don't know how high or now the intel_backlight goes and it is typically different from machine to machine.

Strangely, when I changed /sys/class/backlight/intel_backlight/backlight from 4880 to 3000 it got brighter... when I set it to around 1000 it is now similar to what it was before.  I am now even more unsure as to how these two things relate. I just know that when I use my backlight keys (which worked out of the box) it adjusts the acpi_video0 directory, so that is what I use.

nardev, I think what you should do is learn how to actually write udev rules, as I have a sneaking suspicion that you simply copy and pasted what I exemplified above on a different machine and expected it to work.

Offline

#12 2013-01-28 00:08:28

nardev
Member
Registered: 2013-01-26
Posts: 2

Re: [SOLVED] Thinkpad X220 configure default screen brightness at startup

WonderWoofy wrote:

I believe the external monitor is actually not able to be dimmed or brightened from the system itself.  I may be totally wrong here, but I think you actually have to use the brightness settings on your monitor.

As far as the low brightness, you may have to be using the other brightness file in /sys/class/backlight.  There are typically two directories there and both control some separate element of brightness.  For instance, I have acpi_video0 which goes from 1 to 15 and I have intel_backlight which was set at 4880 when I just checked.  I don't know how high or now the intel_backlight goes and it is typically different from machine to machine.

Strangely, when I changed /sys/class/backlight/intel_backlight/backlight from 4880 to 3000 it got brighter... when I set it to around 1000 it is now similar to what it was before.  I am now even more unsure as to how these two things relate. I just know that when I use my backlight keys (which worked out of the box) it adjusts the acpi_video0 directory, so that is what I use.

nardev, I think what you should do is learn how to actually write udev rules, as I have a sneaking suspicion that you simply copy and pasted what I exemplified above on a different machine and expected it to work.


I mostly agree.

1. For external monitor, i don't mind using brightness control on monitor. Actually i didn't even intend to change that brightness. My problem was monitor on laptop.

2. Concerning udev rules. Thing is that so many things changed. It's quite new concept for me. I read few Debian articles about that and i get an idea about it. Concerning copy/paste, well i don't see what else but the driver should i change there?

Offline

Board footer

Powered by FluxBB