Date: Mon, 29 Mar 2021 13:08:49 -0700 From: Kevin Oberman <rkoberman@gmail.com> To: Softwafe Engineer <timsofteng@gmail.com> Cc: "freebsd-acpi@freebsd.org" <freebsd-acpi@freebsd.org> Subject: Re: Thinkpad t460 acpi issues Message-ID: <CAN6yY1vnXaV1TSSAJDJyewaOVXJxexbZqVWktUpFCJznZFodUQ@mail.gmail.com> In-Reply-To: <CAP7bFfCQJU6xk1ovYp083_AXcJnshOHXf40=Mp72bz3daaVqgA@mail.gmail.com> References: <CAP7bFfCQJU6xk1ovYp083_AXcJnshOHXf40=Mp72bz3daaVqgA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
The best way to support these keys is to use devd to respond to them and dispatch to programs that can do what the key should do. I wanted my new laptop brightness keys to work. pressing them had no obvious effect. I created the following file in /etc/devd/: notify 10 { match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x10"; action "/usr/local/sbin/L15-backlight.pl Brighter"; }; notify 10 { match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x11"; action "/usr/local/sbin/L15-backlight.pl Dimmer"; }; /* notify 10 { match "system" "ACPI"; match "subsystem" "IBM"; action "logger Notify = $notify"; }; */ and trivial perl script (probably sh or python would be most people's choice) to actually do the job: #!/usr/local/bin/perl use strict; use Sys::Syslog; if ($#ARGV != 0) { print STDERR "usage: L15-backlight.pl (incr|decr)"; exit 0; } #openlog("brightness", ,); my $new_bright; my $notify = $ARGV[0]; my $curr_bright = `sysctl -n hw.acpi.video.lcd0.brightness`; if ($notify eq "Brighter") {$new_bright = ($curr_bright + 4)}; if ($notify eq "Dimmer") {$new_bright = ($curr_bright - 4)}; #syslog ("debug", "Notify = $notify, Old = $curr_bright, New = $new_bright "); `sysctl -n hw.acpi.video.lcd0.brightness=$new_bright`; This adjusted the brightness by 5% on each press.You may notice that the adjustment is + or - 4, not 5. It turns out that the brightness keys worked fine, but only adjusted the brightness by 1%. Similar devd entries can work for other keys. The final rule and the log statement in the script are commented out, but can be used to track down which key maps to which event number. I should thank the person who gave me the technique, but I can't seem to find the e-mail. My apologies to him. Kevin Oberman, Part time kid herder and retired Network Engineer E-mail: rkoberman@gmail.com PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683 On Mon, Mar 29, 2021 at 6:16 AM Softwafe Engineer <timsofteng@gmail.com> wrote: > Hello. > Freebsd 13 rc3 > > I'm trying to enable acpi hotkeys on my thinkpad t460 but > unfortunately looks lite it unsupported. > I've loaded acpi_ibm and acpi_video but only three hotkeys works (on > my laptop it's fn+F(number)). > > As well I noticed strange behaviour on closing laptop cover. When I do > it then laptop starts to increase funspeed and no keys or trackpad > reaction after opening. Only reset works (long pressing on power > button). > > Is it possible to add supporting for my laptop? > _______________________________________________ > freebsd-acpi@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-acpi > To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN6yY1vnXaV1TSSAJDJyewaOVXJxexbZqVWktUpFCJznZFodUQ>