Re: Thinkpad t460 acpi issues

2021-04-01 Thread Jung-uk Kim
On 21. 3. 29., Kevin Oberman wrote:
> 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`;

For AMD and Intel GPUs, you may use backlight(8) with amdgpukms.ko or
i915kms.ko rather than sysctl(8) with acpi_video.ko.

Jung-uk Kim

> 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: rkober...@gmail.com
> PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683
> 
> 
> On Mon, Mar 29, 2021 at 6:16 AM Softwafe Engineer 
> 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-unsubscr...@freebsd.org"


Re: Thinkpad t460 acpi issues

2021-04-01 Thread Kevin Oberman
Thanks. Works perfectly!

I take it that backlight is often better as it can be run as a user and
does not require acpi_video to be loaded. I don't see anything in acp_video
that I need if I don't need it to adjust/report brightness. I saw a note in
the comment about drm-devel-kmod about this, but no specific command was
mentioned.
--
Kevin Oberman, Part time kid herder and retired Network Engineer
E-mail: rkober...@gmail.com
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683


On Thu, Apr 1, 2021 at 7:13 PM Jung-uk Kim  wrote:

> On 21. 3. 29., Kevin Oberman wrote:
> > 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`;
>
> For AMD and Intel GPUs, you may use backlight(8) with amdgpukms.ko or
> i915kms.ko rather than sysctl(8) with acpi_video.ko.
>
> Jung-uk Kim
>
> > 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: rkober...@gmail.com
> > PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683
> >
> >
> > On Mon, Mar 29, 2021 at 6:16 AM Softwafe Engineer 
> > 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-unsubscr...@freebsd.org"