вторник, ноября 19, 2024

FreeBSD14 and ThinkPad X1 Carbon Gen9. Brightness with a keyboard

 acpi_ibm(4) provides support for multiple hotkeys on ThinkPad X1 Carbon Gen9, so:

# echo acpi_ibm_load=\"YES\" >> /boot/loader.conf

or it's possible to load that kernel driver on a running system:

# kldload acpi_ibm

Now try to run the following command to see ACPI events:

# cat /var/run/devd.pipe

press brightness up/down keys (those are combined with the F6/F5 keys correspondingly), and see events:

!system=ACPI subsystem=IBM type=\_SB_.PC00.LPCB.EC__.HKEY notify=0x10
!system=ACPI subsystem=IBM type=\_SB_.PC00.LPCB.EC__.HKEY notify=0x11

Moving ahead and creating a configuration file for the devd(8) in /usr/local/etc/devd directory,
let's name it x1cg9.conf:

notify 0 {
        match "system"          "ACPI";
        match "subsystem"       "IBM";
        match "notify"          "0x10";
        action                  "backlight +";
};

notify 0 {
        match "system"          "ACPI";
        match "subsystem"       "IBM";
        match "notify"          "0x11";
        action                  "backlight -";
};