Re: Need help controlling laptom display brightness via sysctl
- In reply to: Kevin Oberman : "Re: Need help controlling laptom display brightness via sysctl"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 07 Jul 2024 19:27:54 UTC
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)