You are not logged in.

#1 2016-12-23 16:24:58

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

ACPI Handler Not Working

Sorry if this seems like a repeated topic, but I have tried a number of solutions before putting up this post. I have  gut feeling that the problem is realted to a conflict of some package with acpid.

My Handler file:

#!/bin/bash
# Default acpi script that takes an entry for all actions
case "$1" in
    button/power)
        case "$2" in
            PBTN|PWRF)
                logger 'PowerButton pressed'
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    video/brightnessup)
        case "$2" in
            BRTUP)
                logger 'Increase Brightness'
                sleep 1; /usr/bin/xset dpms force off
                ;;
            BRTDN)
                logger 'Reduce Brightness'
                ;;
            *)
                logger "ACPI action undefined: $2"
              ;;
        esac
        ;;
esac

This file is me just trying to get something to work, so that I can use acpid events for various functions.

All I am trying to do is to map special keys registered as ACPI events to their specific handlers. Eg: Brightness Up/Down, Volume Up/Down
I can see all functions being registeres through acpi_listen:

[user@pc ~]$ acpi_listen
video/brightnessdown BRTDN 00000087 00000000
video/brightnessup BRTUP 00000086 00000000
button/mute MUTE 00000080 00000000 K
button/volumedown VOLDN 00000080 00000000 K
button/volumeup VOLUP 00000080 00000000 K

The Box:

[user@pc ~]$ uname -a
Linux boolean-pc 4.4.39-1-lts #1 SMP Thu Dec 15 21:10:18 CET 2016 x86_64 GNU/Linux

I had earlier (a lot of months back before systmed came into existence) streamlined these operations on my laptop. A few months back my laptop also changed and with systemd coming into existence the interaction with acpi has become slightly troublesome. I have gone through the systemd and acpi pages on arch wiki.
Please advice!

Offline

#2 2016-12-23 16:40:26

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: ACPI Handler Not Working

As the wiki would have told you, commands like "xset" rely on several variables which are available to the acpid process.

https://wiki.archlinux.org/index.php/Ac … nt_display


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#3 2016-12-24 19:43:15

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

Re: ACPI Handler Not Working

Alad wrote:

As the wiki would have told you, commands like "xset" rely on several variables which are available to the acpid process.

https://wiki.archlinux.org/index.php/Ac … nt_display

Frankly, I overlooked this part of the article. Does this mean that the XDisplay has to be defined within the handler script?

The wiki has a link to an example function within xinitrc. Would this same work with the handler script?

Last edited by theta (2016-12-24 19:44:33)

Offline

#4 2016-12-24 20:35:26

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: ACPI Handler Not Working

The wiki has a link to an example function within xinitrc.

It's not within xinitrc... it's meant to be used together with .xinitrc (i.e., it probably wouldn't work if you use a display manager). The code itself goes in the handler script.

Last edited by Alad (2016-12-24 20:36:02)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#5 2016-12-26 10:04:31

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

Re: ACPI Handler Not Working

Alad wrote:

The wiki has a link to an example function within xinitrc.

It's not within xinitrc... it's meant to be used together with .xinitrc (i.e., it probably wouldn't work if you use a display manager). The code itself goes in the handler script.

I am not getting the hang of the above. Do you mean the getXuser function would work within the handler.sh script?

Also I somehow realized that my Volume Multimedia keys are working. When I tried to manipulate them using the handler script (by changing the amount of increase percentage in volume), I found that its not really being controlled by acpid.

This implies that something else in the system is causing the Volume Multemedia keys to work out of the box. Leading to more confusion.

Using xev and the list at /usr/include/X11/XF86keysym.h, I have verified that the scan codes are correct and matching.

Offline

#6 2016-12-26 10:45:49

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ACPI Handler Not Working

For handling keystrokes, sxhkd works great. I switched to it, as a lightweight replacement to xbindkeys.

Offline

#7 2016-12-26 14:16:22

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: ACPI Handler Not Working

For handling keystrokes, sxhkd works great. I switched to it, as a lightweight replacement to xbindkeys.

Thing with sxhkd or anything using X is that it stops working when something grabs the keys, e.g. a screensaver or full screen application.

This implies that something else in the system is causing the Volume Multemedia keys to work out of the box. Leading to more confusion.

Depends on what you have installed. Most of the desktop environments have some mechanism in place, for example.

I am not getting the hang of the above. Do you mean the getXuser function would work within the handler.sh script?

I failed to notice there's no more getXuser function... you'd put the snippet in your handler to export the needed variables (USER, DISPLAY and XAUTHORITY) then run your programs like so:

sudo -u "$USER" fooapp

Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#8 2016-12-26 15:27:32

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ACPI Handler Not Working

Alad wrote:

Thing with sxhkd or anything using X is that it stops working when something grabs the keys, e.g. a screensaver or full screen application.

Screensaver yes, but sxhkd works fine with full-screen games in my experience. I use XFCE.

Offline

#9 2016-12-27 05:33:30

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

Re: ACPI Handler Not Working

brebs wrote:

For handling keystrokes, sxhkd works great. I switched to it, as a lightweight replacement to xbindkeys.

Sounds like a decent alternative. Will give it a shot.

Alad wrote:

Depends on what you have installed. Most of the desktop environments have some mechanism in place, for example.

I have openbox with sddm. My system is extremely custom configured, to the extent I forget sometimes what all I have done. Its been built up since back in 2008. So I am doubtful as to what would cause the Multemedia Keys to work.

Offline

#10 2016-12-27 05:38:11

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

Re: ACPI Handler Not Working

theta wrote:

I have openbox with sddm. My system is extremely custom configured, to the extent I forget sometimes what all I have done. Its been built up since back in 2008. So I am doubtful as to what would cause the Multemedia Keys to work.

Ok I just realized that I had configured openbox to use the Volume buttons. Verified it. I should probably do the same for the brightness buttons.

PS: Any suggestions for overlays to use with openbox

Offline

Board footer

Powered by FluxBB