Re: acpi_ibm brightness man page example not working + fix

From: LuMiWa <lumiwa_at_dismail.de>
Date: Fri, 16 Aug 2024 23:47:00 UTC
On Fri, 16 Aug 2024 17:53:38 -0500
"Marc Coquand" <marc@mccd.space> wrote:

> Hi!
> 
> Apologize in advance if I'm reporting this wrong, this is my first
> post to the mailing list and my first time contributing to Freebsd. :)
> 
> I noticed that the example in the manpage for acpi_ibm, specifically
> for setting up brightness was not working for me. The specific part
> that did not work for me is:
> 
> + 0x10|0x11)
> +       LEVEL=`sysctl -n dev.acpi_${OEM}.0.lcd_brightness`
> +       PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \
> +               ${LEVEL} / ${MAX_LCD_BRIGHTNESS} * 100" |\
> +               ${CALC} | ${CUT} -d . -f 1`
> +       MESSAGE="brightness level ${PERCENT}%"
> +       ;;
> +
> 
> This was tested on my Thinkpad T480s. It makes sense that it would not
> work, because manually changing the brightness with `sysctl
> dev.acpi_ibm.0.lcd_brightness=XXX` did not do anything either on my
> laptop.
> 
> Since FreeBSD 13.0, there is a new backlight utility, and with that I
> was able to fix backlight on my computer by simply creating the
> following devd config:
> 
> /etc/devd/acpi_ibm_brightness.conf
> + notify 20 {
> +       match "system" "ACPI";
> +       match "subsystem" "IBM";
> +       match "notify" "0x10";
> +       action "/usr/bin/backlight incr 10";
> + };
> +
> + notify 20 {
> +       match "system" "ACPI";
> +       match "subsystem" "IBM";
> +       match "notify" "0x11";
> +       action "/usr/bin/backlight decr 10";
> + };
> 
> Maybe the examples in acpi_ibm manpages should use backlight utility
> instead?
> 
> Alternatively, maybe the devd rules above could be added by default so
> that backlight works out of the box if you load acpi_ibm? It'd be easy
> to also add support for volume control with mixer. I am happy to make
> a patch if this is of interest.
> 
> Sincerely,
> Marc
> 

Thank you very much for acpi_ibm_brightness.conf :). It works on my
T495 too.


-- 
“I hate books; they only teach us to talk about things we know nothing
about.”

― Jean-Jacques Rousseau