Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Numeric acpi events - how to catch them?
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
widlokm
Tux's lil' helper
Tux's lil' helper


Joined: 22 Sep 2007
Posts: 75
Location: Poland

PostPosted: Wed May 24, 2017 6:48 pm    Post subject: [SOLVED] Numeric acpi events - how to catch them? Reply with quote

Hello,

I'm using Lenovo T400 laptop with THINKPAD_ACPI kernel module enabled. This driver can pass to user space acpi events related to battery/hardware state of the laptop like:
(taken from linux/Documentation/laptops/thinkpad-acpi.txt):
0x2313 ALARM: System is waking up from suspend because battery is near empty

The question is: How to catch this even with acpid?
For typical events like buttons the line in /etc/acpi/events/button-something file is:
Code:
event=button/sleep
action=/etc/acpi/button_sleep.sh

How to create event and action for this battery alarm? Should it be something like:
Code:
event=0x2313
action=/etc/acpi/battery_alarm.sh


Thanks in advance
Best Regards,
Michael Widlok


Last edited by widlokm on Fri May 26, 2017 6:20 am; edited 1 time in total
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 547
Location: NRW, Germany

PostPosted: Wed May 24, 2017 8:22 pm    Post subject: Reply with quote

manpage wrote:
The event value is a regular expression (see regcomp(3)), against which events are matched.
Back to top
View user's profile Send private message
widlokm
Tux's lil' helper
Tux's lil' helper


Joined: 22 Sep 2007
Posts: 75
Location: Poland

PostPosted: Wed May 24, 2017 9:09 pm    Post subject: Reply with quote

The acpid manual was the first place where I wanted to find the answer, unfortunately it does not tell me what the event will be. A string "0x2313" a number? All examples I found during long searching are only for buttons. So more generic: How the "event=" line should look like to catch numeric events?
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 547
Location: NRW, Germany

PostPosted: Thu May 25, 2017 10:43 am    Post subject: Reply with quote

widlokm wrote:
The acpid manual was the first place where I wanted to find the answer, unfortunately it does not tell me what the event will be. A string "0x2313" a number?

Regexprs are used to match strings, so it must be a string.
Back to top
View user's profile Send private message
s4e8
Guru
Guru


Joined: 29 Jul 2006
Posts: 311

PostPosted: Thu May 25, 2017 2:38 pm    Post subject: Reply with quote

According to the doc, the event format/string is
ibm/hotkey HKEY 00000080 0000xxxx
for your case is:
ibm/hotkey HKEY 00000080 00002313
Back to top
View user's profile Send private message
widlokm
Tux's lil' helper
Tux's lil' helper


Joined: 22 Sep 2007
Posts: 75
Location: Poland

PostPosted: Fri May 26, 2017 6:23 am    Post subject: Reply with quote

Thank You s4e8, that's it.
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