Brightness Function Keys Issue

Hi.

I'll make this post short and sweet. I usually run linux on my laptop but am wondering if BSD would be able to work as well in terms of compatibility with the brightness keys. I have a Lenovo X260 and after installing arch realised that there was an issue with these functions keys not functioning without additional software running in the background. I usually use XFCE on with it's bundled power manager because it handles the brightness well but I don't want to be forced to use it if I chose to install another window manager. I've read about the xbrightness solution through keybinding but is there any other way to get these keys to function regardless of whether I'm running X11?

Thanks,
 
To get the brightness keys working on my x230 (including without X), I've followed the directions in acpi_ibm(4), which involves editing devd.conf (or /usr/local/etc/devd/*.conf) to match the ACPI/IBM event, and creating a /usr/local/sbin/acpi_oem_exec.sh to handle it. (This is all documented in the man page.)

However, I've had to replace the 0x10|0x11) case with the following:

Code:
    0x10)
        LVL=`sysctl -n hw.acpi.video.lcd0.brightness`
        LVL=$(((LVL / 10 + 1) * 10))
        sysctl hw.acpi.video.lcd0.brightness=${LVL}
        MESSAGE="LEVEL ${LVL}"
        ;;
    0x11)
        LVL=`sysctl -n hw.acpi.video.lcd0.brightness`
        LVL=$((((LVL + 1) / 10 - 1) * 10))
        [ ${LVL} -lt 10 ] && LVL=5
        sysctl hw.acpi.video.lcd0.brightness=${LVL}
        MESSAGE="LEVEL ${LVL}"
        ;;

It looks a little weird, but the valid levels (on mine) seem to actually be 5, 10, 20, ... 100; the combination of commands above provides those settings. Perhaps yours is similar...
 
An old HP is different, the levels are not with constant interval. Not a big deal, but irritating.
I used this, most likely it could be smarter.

Juha

Code:
#!/bin/sh
#
# LCD backlight brightness
# Thu Aug 18 01:18:01 EEST 2016

base=hw.acpi.video.lcd0

avail="${base}.levels"
level="${base}.brightness"

was=`sysctl -n "$level"` || exit 1

case "$*" in
[0-9]*)
        was="$1"
        compare=-ge  # nearest would be better, but ...
        reverse=
        ;;
incr)
        compare=-gt
        reverse=
        ;;
decr)
        compare=-lt
        reverse=-r
        ;;
"")
        echo "$was" ; exit 0 ;;
*)
        echo "Usage: ${0##*/} PERCENT/incr/decr" >&2 ; exit 2 ;;
esac

sysctl -n "$avail" | tr ' ' '
' | sort -n $reverse | while read new
do
        if [ "$new" "$compare" "$was" ]
        then
                exec sysctl "$level=$new" > /dev/null
                exit
        fi
done

exit 1 # sad to report
 
An old HP is different, the levels are not with constant interval. Not a big deal, but irritating.
I used this, most likely it could be smarter.

My *.levels list includes 0, 1, .. 100, even though many of them don't really change anything, so unfortunately this approach wouldn't work.
 
For Thinkpad x220/x230 users, I have submitted a patch to enable mic led on/off. One can listen to devd event, toggle the mic mixer state and mic led state using dev.acpi_ibm.0.mic_led=1.

The patch can be found here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229074 .

I'm also working on more patches to enable FreeBSD acpi support on newer Thinkpad models (brightness keys, mic mute, etc...)
 
Can someone tell why the brightness is set to 100 after sleep sometimes (but sometimes not)? So when the screen goes on I get full brightness?

... the value of hw.acpi.video.lcd0.brightness is not really 100 but the brightness is full ...
 
Here is the ThinkWiki page for the X260 showing keymapping and how to activate different functions.

When I'm looking to buy a Thinkpad this is where I check what options that model has.
 
There are multiple brightness settings/sysctls.
Try this:
sysctl -ad |grep lcd
There are brightness levels for full power mode, economy mode, current brightness... So maybe try editing those?
 
I've already set hw.acpi.video.lcd0.fullpower, economy and brightness to 10.
dev.acpi_ibm.0.lcd_brightness is 0
 
Back
Top