# What do you mean by 'acpid' events.

## dE_logics

I know what's acpi events but how do you get the 'event' string of /etc/acpi/actions/* filled to your desired event? For e.g the ac power state, the battery level etc... i.e I want the strings to specify my desired event, so from where do I get these strings?

Also acpid looks deprecated, is there any 'modern' way to automatically execute commands depending on acpi events?

----------

## bobspencer123

I'm a little confused by your question, but I think you are asking how you monitor acpi events and then do something with them.

First you should see acpi events in /var/log/messages

then you add appropriate action for the event in /etc/acpi/actions (I think this is where its at I'm not at my laptop atm).

Your second question:

You can use power management software like pm-utils or all in encompassing pm suites like powerdevil to do most basic things like suspend, hibernate, turn down lcd brightness, scale cpu, etc... I think each major de has their own pm suites too ... i.e. powerdevil is for kde I would assume gnome has something similar.

----------

## dmpogo

 *bobspencer123 wrote:*   

> I'm a little confused by your question, but I think you are asking how you monitor acpi events and then do something with them.
> 
> First you should see acpi events in /var/log/messages
> 
> then you add appropriate action for the event in /etc/acpi/actions (I think this is where its at I'm not at my laptop atm).
> ...

 

It is /etc/acpi/events.   And you can use a combination of filtering either first in /etc/acpi/events/somefile  or later fine tuning in the script defined in somefile to be called.  I could give you an example of mine, but laptop is at home.Last edited by dmpogo on Tue Jan 18, 2011 4:42 pm; edited 1 time in total

----------

## dmpogo

I found acpid to be the most clear and transparent interface to ACPI events, if one wants to call custom scripts and a have fine-tuned control.

Especially I like it since this is on a low level and can work independently on DE or X (I like suspend/hibernate to work when I close my lid with whatever is running as DE at the moment  :Smile:  ).  I don't know of replacement for this functionality, although each DE has its own ACPI handlers, if you wish to use them.

----------

## dE_logics

I've made the question more clear.

Yes, I'm using /etc/acpi/actions/*, problem is with the 'event' field... I don't know what strings to fill in it... from where do I get these strings?

----------

## M

You get strings from /var/log/messages, at least I get it from there when I configured acpid.

----------

## tomk

There are some examples in the Power Management Guide.

----------

## dmpogo

 *dE_logics wrote:*   

> I've made the question more clear.
> 
> Yes, I'm using /etc/acpi/actions/*, problem is with the 'event' field... I don't know what strings to fill in it... from where do I get these strings?

 

Use   acpi_listen  which comes with acpid package

----------

## dE_logics

 *dmpogo wrote:*   

>  *dE_logics wrote:*   I've made the question more clear.
> 
> Yes, I'm using /etc/acpi/actions/*, problem is with the 'event' field... I don't know what strings to fill in it... from where do I get these strings? 
> 
> Use   acpi_listen  which comes with acpid package

 

Yup, that's it. Thanks

One more question... is there an acpi event when the battery level drops to a certain level?

----------

## dmpogo

 *dE_logics wrote:*   

>  *dmpogo wrote:*    *dE_logics wrote:*   I've made the question more clear.
> 
> Yes, I'm using /etc/acpi/actions/*, problem is with the 'event' field... I don't know what strings to fill in it... from where do I get these strings? 
> 
> Use   acpi_listen  which comes with acpid package 
> ...

 

If I remember correctly (and again my laptop is at home  :Smile:  ) on my laptop  ACPI events ARE generated when battery passes some predefined levels (low level, critical) but the events are all the same. One can not find from event code what has happened, so the handling script has to look into /sys/class/power/BAT0 (or also BAT1 if you have two batteries as I do),  parse 'status' or 'current_power' file and has some logic to deal with it.

I am surely misremembering the names of individual files and perhaps the whole issue as well  :Smile: 

Same thing was with lid - events generated on opening and closing the lid were the same on my machine. so script had to check lid state after catching the event

----------

## dE_logics

Ok. Got that, thanks.

----------

