View previous topic :: View next topic |
Author |
Message |
widlokm Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 22 Sep 2007 Posts: 75 Location: Poland
|
Posted: Wed May 24, 2017 6:48 pm Post subject: [SOLVED] Numeric acpi events - how to catch them? |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Dr.Willy Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 15 Jul 2007 Posts: 547 Location: NRW, Germany
|
Posted: Wed May 24, 2017 8:22 pm Post subject: |
|
|
manpage wrote: | The event value is a regular expression (see regcomp(3)), against which events are matched. |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
widlokm Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 22 Sep 2007 Posts: 75 Location: Poland
|
Posted: Wed May 24, 2017 9:09 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Dr.Willy Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 15 Jul 2007 Posts: 547 Location: NRW, Germany
|
Posted: Thu May 25, 2017 10:43 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
s4e8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 29 Jul 2006 Posts: 311
|
Posted: Thu May 25, 2017 2:38 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
widlokm Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 22 Sep 2007 Posts: 75 Location: Poland
|
Posted: Fri May 26, 2017 6:23 am Post subject: |
|
|
Thank You s4e8, that's it. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|