Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Power button press generates two ACPI events (a bug?)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
niku
n00b
n00b


Joined: 23 Dec 2018
Posts: 35

PostPosted: Sun Dec 23, 2018 5:49 am    Post subject: Power button press generates two ACPI events (a bug?) Reply with quote

A power button press on laptop (kernel: 4.14.83-gentoo) generates two ACPI events:

Quote:
button/power PBTN 00000080 00000000
button/power LNXPWRBN:00 00000080 00000001


Meanwhile /etc/acpi/default.sh tests only for "button/power" and therefore runs the action twice. (So, in the folliwing code, after resuming from hibernation, I got automatically hibernated again.)
Code:

case "$group" in
        button)
                case "$action" in
                        power)
                                #/etc/acpi/actions/powerbtn.sh
                                /usr/bin/pm-hibernate
                                ;;
                esac
                ;;


For the desired action, I changed the above to,

Code:

case "$group" in
        button)
                case "$action" in
                        power)
                                [ "$device" = PBTN ] && /usr/bin/pm-hibernate || log_unhandled $*
                                ;;
                esac
                ;;
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14367

PostPosted: Sun Dec 23, 2018 4:36 pm    Post subject: Reply with quote

BIOSes are notoriously inconsistent in this area.

With your change, you will get a log_unhandled if pm-hibernate fails. Is that what you want? I think you might have wanted:
Code:
case "$group" in
      button)
            case "$action" in
                  power)
                        if [ "$device" = PBTN ]; then
                           /usr/bin/pm-hibernate
                        else
                           log_unhandled "$@"
                        fi
                        ;;
            esac
            ;;
Back to top
View user's profile Send private message
niku
n00b
n00b


Joined: 23 Dec 2018
Posts: 35

PostPosted: Mon Dec 24, 2018 3:50 am    Post subject: Reply with quote

Oh right. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum