Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jul 2024 22:27:54 +0300
From:      Anton Shepelev <anton.txt@gmail.com>
To:        freebsd-stable@freebsd.org
Subject:   Re: Need help controlling laptom display brightness via sysctl
Message-ID:  <20240707222754.2a531eb3344cb4644c571c66@gmail.com>
References:  <20240704010029.75608a4e49205eb38a6034be@gmail.com> <20240705005834.4c7983ea29da3af8f8e36718@gmail.com> <CAN6yY1uo%2Be6pY1H7JSyHKjjbB8O6a_UAoW=NoagzXSCc%2BHzaHQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I wrote to Kevin Oberman:

> I fear you missed my point that HP seems to have a
> different approach to these ACPI events.  In ThinkPad, the
> up- and down-brighness events have fixed notify codes:
> 0x10 and 0x11.  In HP, on the other hand, the notify codes
> represent the target brightness level on a 0..100 scale,
> so that consequtive presses of Fn+F3 yield an arithmetical
> progression of notify codes, e.g. 51,52,53 &c, which is
> why the simplest solution is to subsitute the notify value
> into the invocation of `backlight'.
>
> Translating those codes into exponential changes would
> require first of all to recall the previous value in order
> to determine whether the current event is an increase or a
> decrease.

Indeed, and here is my final devd action stript:

   REF=50 # an (arbitrary) reference value
   NEW=$1 # the new brightness value as recevied from ACPI

   # Ignore the ref. value to avoid an infinite loop:
   if [ $NEW -eq $REF ]; then exit 0; fi

   # Determine whether to increase or decrease the brightness:
   if [ $NEW -lt $REF ];
        then OP=decr
        else OP=incr; fi

   # Change brightness:
   backlight $OP

   # Restore the reference value:
   sysctl hw.acpi.video.lcd0.brightness=$REF
   # (in this system it has no effect on the actual brightness)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240707222754.2a531eb3344cb4644c571c66>