[Blend-tinker-devel] [teknik] terres 1

Jonas Smedegaard jonas at homebase.dk
Thu Aug 20 15:06:26 BST 2020


[ regarding TERES-I, translated from a post in a danish list... ]

Quoting Anders Krøyer (2020-08-20 12:22:59)
> On 20/08/2020 12.19, Anders Krøyer wrote:
> > I have a question, is there some way I can turn up the light for the 
> > screen?
> 
> strike that, I figured it out in GUI, is there some way to control it 
> without graphical interface?

Lovely question - because that exact detail is something I have spent 
quite some time on, and reached progress (not just fumbled blindly) :-)

I have not yet formally documented or automated configuration, but here 
is what I have discovered until now:

It requires a) locating brightness device, b) setting up daemon to 
transform key presses to "10% more/less of current brightness and apply 
new brightness to the device, c) reprogramming the Linux interpretation 
of the keyboard to recognize media keys for brightness, d) setup daemon 
to capture key presses for media keys for brightness, and e) setup 
daemon to set access rights for e.g. brightness device (otherwise only 
root can control it).

a) was some months ago corrected in the Linux kernel to use a 
standardised name: /sys/class/backlight/backlight/brightness

(previously it was more hassle to work with...)

b) is handled by installing package "brightnessctl" (and requires no 
configuration, now that the device has a sensible name).

c) did I solve a few months ago, reported it to the "systemd" proect, 
and they adopted my correction so it is now officially a part of all 
modern Linux-based systems.

(this correction + a) was all it required to use under rich graphical 
interfaces like the one you use - "Xfce" - but not enough for the more 
terse interfaces I use - "i3" and "Sway", neither is it enough to work 
in a plain console)

d) is achieved by installing package "triggerhappy" and adding 
configuration file "/etc/triggerhappy/triggers.d/local-brightness.conf" 
with this content:

KEY_BRIGHTNESSDOWN              1       brightnessctl set 10%-
KEY_BRIGHTNESSDOWN              2       brightnessctl set 10%-
KEY_BRIGHTNESSUP                1       brightnessctl set 10%+
KEY_BRIGHTNESSUP                2       brightnessctl set 10%+

e) requires adjusting the daemon "udev" - e.g. concretely by adding 
configuration file "/etc/udev/rules.d/90-local-brightnessctl.rules" with 
this content:

ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chown nobody /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp nobody /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp input /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"

(The change relaxes security generally a bit: anyone with access to the 
machine - not only root - can turn up and down brightness. Alternatively 
the dæmon brightnessctl can be executed as root but that would be a 
bigger security risk)


Regards,

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://alioth-lists.debian.net/pipermail/blend-tinker-devel/attachments/20200820/085f7c18/attachment.sig>


More information about the Blend-tinker-devel mailing list