[arch-general] Systemd screen brightness
Hey everyone, I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight. Previously, I had entered the following in my /etc/acpi/handler.sh to handle the acpi events generated when those keys were pressed: video/brightnessdown) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) -1)) > /sys/class/backlight/acpi_video0/brightness ;; video/brightnessup) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) +1)) > /sys/class/backlight/acpi_video0/brightness ;; However, as I am working on migrating to systemd, acpid no longer runs and hence does not handle these events. How can I write a similar handler into systemd? Thanks, Mike
You can run systemctl start acpid.service. Change start to enable if you want to run it on boot. Regards, Z On Tue, 2012-08-14 at 21:30 -0400, Michael Nawrocki wrote:
Hey everyone,
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight. Previously, I had entered the following in my /etc/acpi/handler.sh to handle the acpi events generated when those keys were pressed:
video/brightnessdown) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) -1)) > /sys/class/backlight/acpi_video0/brightness ;;
video/brightnessup) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) +1)) > /sys/class/backlight/acpi_video0/brightness ;;
However, as I am working on migrating to systemd, acpid no longer runs and hence does not handle these events. How can I write a similar handler into systemd?
Thanks,
Mike
On Wed, Aug 15, 2012 at 7:00 AM, Michael Nawrocki <zaedrake@gmail.com>wrote:
Hey everyone,
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight. Previously, I had entered the following in my /etc/acpi/handler.sh to handle the acpi events generated when those keys were pressed:
video/brightnessdown) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) -1)) > /sys/class/backlight/acpi_video0/brightness ;;
video/brightnessup) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) +1)) > /sys/class/backlight/acpi_video0/brightness ;;
However, as I am working on migrating to systemd, acpid no longer runs and hence does not handle these events. How can I write a similar handler into systemd?
Thanks,
Mike
I used to reduce my brightness using a similar command in /etc/rc.local (/bin/echo -n 0 > /sys/class/backlight/acpi_video0/brightness) but for the reasons that you mention this won't work anymore. I then switched to using X's brightness handler (xbacklight -set 0) which reduces display brightness as X starts. This is an easy solution but only works if you use X or if the delayed reduction in brightness is acceptable to you. HTH -- Aurko Roy GPG key: 0x20C5BC31 Fingerprint:76B4 9677 15BE 731D 1949 85BA 2A31 B442 20C5 BC31
Aurko Roy [2012.08.15 1140 +0530]:
On Wed, Aug 15, 2012 at 7:00 AM, Michael Nawrocki <zaedrake@gmail.com>wrote:
Hey everyone,
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight. Previously, I had entered the following in my /etc/acpi/handler.sh to handle the acpi events generated when those keys were pressed:
video/brightnessdown) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) -1)) > /sys/class/backlight/acpi_video0/brightness ;;
video/brightnessup) echo $(($(cat /sys/class/backlight/acpi_video0/brightness) +1)) > /sys/class/backlight/acpi_video0/brightness ;;
However, as I am working on migrating to systemd, acpid no longer runs and hence does not handle these events. How can I write a similar handler into systemd?
Thanks,
Mike
I used to reduce my brightness using a similar command in /etc/rc.local (/bin/echo -n 0 > /sys/class/backlight/acpi_video0/brightness) but for the reasons that you mention this won't work anymore. I then switched to using X's brightness handler (xbacklight -set 0) which reduces display brightness as X starts. This is an easy solution but only works if you use X or if the delayed reduction in brightness is acceptable to you.
You can achieve the same by adding the instructions to write to /sys/class/backlight/acpi_video0/brightness to an appropriate file in tmpfiles.d. Read the section on temporary files in the systemd page on the archwiki. Cheers, Norbert
On Wed, Aug 15, 2012 at 4:45 PM, Norbert Zeh <nzeh@cs.dal.ca> wrote:
You can achieve the same by adding the instructions to write to /sys/class/backlight/acpi_video0/brightness to an appropriate file in tmpfiles.d. Read the section on temporary files in the systemd page on the archwiki.
Cheers, Norbert
Thanks for the reference. So something like 'w /sys/class/backlight/acpi_video0/brightness - - - - 0' should do the job, except that /sys/class/backlight/acpi_video0 does not exist since acpi does not seem to be running (I recall reading somewhere that systemd handles most acpi functionality, is that correct?). On Wed, Aug 15, 2012 at 2:32 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Am 15.08.2012 03:30, schrieb Michael Nawrocki:
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight.
I am curious. With 3.3 and earlier, my keys used to adjust brightness on their own. Since 3.4, they don't, and only work in KDE, but not on the console.
Was it a deliberate kernel change that the brightness keys have no effect?
Brightness keys seem to be working fine on 3.5.1.1 (testing). Perhaps it is a problem specific to your setup? -- Aurko Roy GPG key: 0x20C5BC31 Fingerprint:76B4 9677 15BE 731D 1949 85BA 2A31 B442 20C5 BC31
Aurko Roy [2012.08.15 2040 +0530]:
On Wed, Aug 15, 2012 at 4:45 PM, Norbert Zeh <nzeh@cs.dal.ca> wrote:
You can achieve the same by adding the instructions to write to /sys/class/backlight/acpi_video0/brightness to an appropriate file in tmpfiles.d. Read the section on temporary files in the systemd page on the archwiki.
Cheers, Norbert
Thanks for the reference. So something like
'w /sys/class/backlight/acpi_video0/brightness - - - - 0'
should do the job, except that /sys/class/backlight/acpi_video0 does not exist since acpi does not seem to be running (I recall reading somewhere that systemd handles most acpi functionality, is that correct?).
My apologies. I wasn't aware that the particular file you're trying to write to exists only if acpid is running. I personally went back to running acpid because systemd's handling of ACPI events is too rudimentary for my needs. As far as I understand from the manpage, you can only set under which conditions it should handle Lid/Sleep/Power button events. If these conditions are met, systemd handles these events the way systemd thinks they should be handled, and there seems to be no room to customize it. Since I never ever shut down my laptop except using "halt" or now "systemctl poweroff", I found it convenient to set the action for power button events to be to put the machine to sleep, as this avoids the finger gymnastics required to activate the sleep button. This type of customization is possible using acpid but doesn't seem to be possible using systemd alone. Cheers, Norbert
On Thu, Aug 16, 2012 at 1:50 AM, Norbert Zeh <nzeh@cs.dal.ca> wrote:
Aurko Roy [2012.08.15 2040 +0530]:
On Wed, Aug 15, 2012 at 4:45 PM, Norbert Zeh <nzeh@cs.dal.ca> wrote:
You can achieve the same by adding the instructions to write to /sys/class/backlight/acpi_video0/brightness to an appropriate file in tmpfiles.d. Read the section on temporary files in the systemd page on the
archwiki.
Cheers, Norbert
Thanks for the reference. So something like
'w /sys/class/backlight/acpi_video0/brightness - - - - 0'
should do the job, except that /sys/class/backlight/acpi_video0 does not exist since acpi does not seem to be running (I recall reading somewhere that systemd handles most acpi functionality, is that correct?).
My apologies. I wasn't aware that the particular file you're trying to write to exists only if acpid is running. I personally went back to running acpid because systemd's handling of ACPI events is too rudimentary for my needs. As far as I understand from the manpage, you can only set under which conditions it should handle Lid/Sleep/Power button events. If these conditions are met, systemd handles these events the way systemd thinks they should be handled, and there seems to be no room to customize it. Since I never ever shut down my laptop except using "halt" or now "systemctl poweroff", I found it convenient to set the action for power button events to be to put the machine to sleep, as this avoids the finger gymnastics required to activate the sleep button. This type of customization is possible using acpid but doesn't seem to be possible using systemd alone.
Cheers, Norbert
I see. Thanks for the clarification. -- Aurko Roy GPG key: 0x20C5BC31 Fingerprint:76B4 9677 15BE 731D 1949 85BA 2A31 B442 20C5 BC31
Am 15.08.2012 03:30, schrieb Michael Nawrocki:
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight.
I am curious. With 3.3 and earlier, my keys used to adjust brightness on their own. Since 3.4, they don't, and only work in KDE, but not on the console. Was it a deliberate kernel change that the brightness keys have no effect?
On Wednesday 15 Aug 2012 11:02:03 Thomas Bächler wrote:
I am curious. With 3.3 and earlier, my keys used to adjust brightness on their own. Since 3.4, they don't, and only work in KDE, but not on the console.
Was it a deliberate kernel change that the brightness keys have no effect?
They work fine in my case. So, the problem might be specific to your keys. -- Cheers and Regards Jayesh Badwaik stop html mail | always bottom-post www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
On 08/15/2012 05:02 AM, Thomas Bächler wrote:
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight. I am curious. With 3.3 and earlier, my keys used to adjust brightness on
Am 15.08.2012 03:30, schrieb Michael Nawrocki: their own. Since 3.4, they don't, and only work in KDE, but not on the console.
Was it a deliberate kernel change that the brightness keys have no effect?
I had the same problem as you did; hence the script I wrote. I haven't tried the newest kernel yet, and I couldn't find much information on why the kernel update messed that up...
Am 16.08.2012 04:40, schrieb Michael Nawrocki:
On 08/15/2012 05:02 AM, Thomas Bächler wrote:
I'm trying to get my laptop backlight keys (fn+f6/f7) to adjust the brightness of my toshiba laptop backlight. I am curious. With 3.3 and earlier, my keys used to adjust brightness on
Am 15.08.2012 03:30, schrieb Michael Nawrocki: their own. Since 3.4, they don't, and only work in KDE, but not on the console.
Was it a deliberate kernel change that the brightness keys have no effect?
I had the same problem as you did; hence the script I wrote. I haven't tried the newest kernel yet, and I couldn't find much information on why the kernel update messed that up...
Maybe it's the Toshiba ACPI driver - I have a Toshiba, too. It's not too bad because KDE catches the brightness keys and takes care of them. It's just annoying when I use the console.
found this post while googling, left it open in a tab while i worked the problem, here is the solution: https://bbs.archlinux.org/viewtopic.php?pid=1281637#p1281637
participants (7)
-
Aurko Roy
-
Jayesh Badwaik
-
Michael Nawrocki
-
Norbert Zeh
-
Super Nathan
-
Thomas Bächler
-
Zhengyu Xu