WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to use acpid?  (Read 9177 times)

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
How to use acpid?
« on: November 15, 2009, 05:03:01 AM »
When I try to use acpid, I get
Code: [Select]
acpid: can't open /proc/acpi/event: Device or resource busy
Looking at /proc/acpi/event this is an icon with a cross over it... broken link?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: How to use acpid?
« Reply #1 on: November 15, 2009, 05:43:05 AM »
Is acpid already running maybe? What is the result of "ps aux | grep acpid"?

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #2 on: November 15, 2009, 02:55:59 PM »
Code: [Select]
ps aux | grep acpid
   14 root     [kacpid]
11168 tc       grep acpid

I have no idea what all that means... what I'm trying to achieve is start working on making my power button work. I have no idea of where the events are sent to.

« Last Edit: November 15, 2009, 07:30:10 PM by jur »

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #3 on: November 15, 2009, 07:34:40 PM »
OK I checked and I do have acpi and acpid in the /tce folder so these are mounted at boot. I guess I'm stuck at what to do next. I'll see if I can get some info elsewhere first.

What would be great, if a default script file could be supplied along with tc or acpid, one that handles typical power button events, one that could be modified to suit individual systems. I understand all that would be needed is to perhaps change the number that a button event generates? That would greatly ease the process of learning to live with tc.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: How to use acpid?
« Reply #4 on: November 15, 2009, 10:26:21 PM »
You could have a look at this thread for some acpi info:

http://forum.tinycorelinux.net/index.php?topic=2813.msg14648#msg14648

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: How to use acpid?
« Reply #5 on: November 15, 2009, 10:33:46 PM »
I have no idea what all that means... what I'm trying to achieve is start working on making my power button work. I have no idea of where the events are sent to.

It was a way of testing if the acpi daemon was already running - I've seen the error message you got when acpid is already running

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #6 on: November 17, 2009, 04:33:08 PM »
I have made some progress... at this point I can make a program execute when I press the power button. But exittc, while it works when typing this in a terminal, won't open up when pressing the power button when called from the actions file, and I'm stuck at what to do to troubleshoot. Bigpcman's thread while very helpful didn't help for that.   ???

Second problem, I haven't figured out how to enable the whole lot when rebooting. So far I have only been able to make it work by manually running sudo acpid after booting. But including acpid in bootlocal.sh didn't work. I have saved the files in /etc/acpi/events and /etc/acpi/actions in filetool and these are restored succesfully after rebooting.

Any hints?  ???

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #7 on: November 18, 2009, 02:21:54 AM »
* bump *

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to use acpid?
« Reply #8 on: November 18, 2009, 10:15:39 AM »
I have made some progress... at this point I can make a program execute when I press the power button. But exittc, while it works when typing this in a terminal, won't open up when pressing the power button when called from the actions file, and I'm stuck at what to do to troubleshoot. Bigpcman's thread while very helpful didn't help for that.   ???

Second problem, I haven't figured out how to enable the whole lot when rebooting. So far I have only been able to make it work by manually running sudo acpid after booting. But including acpid in bootlocal.sh didn't work. I have saved the files in /etc/acpi/events and /etc/acpi/actions in filetool and these are restored succesfully after rebooting.

Any hints?  ???

Could you post your event and action files and their associated permissions. Maybe Something will come to mind if we can see more specifically what you have done.
« Last Edit: November 18, 2009, 10:21:36 AM by bigpcman »
big pc man

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #9 on: November 18, 2009, 04:52:13 PM »
I have been able to get acpid running by adding

Code: [Select]
sudo killall acpid
sudo acpid
to the .xsession file.

The power button event calls an action file

Code: [Select]
#!/bin/sh
sudo poweroff

I have tried exittc instead of sudo poweroff but somehow it simply won't be called from there. I don't know how to troubleshoot. I don't see any error msgs when running the action file in a terminal.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to use acpid?
« Reply #10 on: November 18, 2009, 04:56:49 PM »
I have been able to get acpid running by adding

Code: [Select]
sudo killall acpid
sudo acpid
to the .xsession file.

The power button event calls an action file

Code: [Select]
#!/bin/sh
sudo poweroff

I have tried exittc instead of sudo poweroff but somehow it simply won't be called from there. I don't know how to troubleshoot. I don't see any error msgs when running the action file in a terminal.

Did you try "/usr/bin/exittc" ? Please post "poweroff".


This is what I have but I'm running this on mc2.2.
Code: [Select]
Event file code

power
event=button[ /]power
action=/etc/acpi/actions/power.sh "%e"

Code: [Select]
power.sh code

#! /bin/sh
#
exittc
« Last Edit: November 18, 2009, 05:11:00 PM by bigpcman »
big pc man

Offline Kingdomcome

  • Sr. Member
  • ****
  • Posts: 286
Re: How to use acpid?
« Reply #11 on: November 18, 2009, 05:23:28 PM »
Not to get in the middle of an acpi discussion of which I know little, let me suggest using the command "exitcheck.sh" as an automatic power down with backup.

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #12 on: November 18, 2009, 05:28:08 PM »
Did you try "/usr/bin/exittc" ? Please post "poweroff".
"poweroff" is a direct command not a script written by me (not sure where it is, /usr/bin?). I haven't tried "/usr/bin/exittc".

Quote
This is what I have but I'm running this on mc2.2.
Code: [Select]
Event file code

power
event=button[ /]power
action=/etc/acpi/actions/power.sh "%e"

Code: [Select]
power.sh code

#! /bin/sh
#
exittc
My code is identical except I haven't got "[ /]", only "/" - what's the difference?

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to use acpid?
« Reply #13 on: November 18, 2009, 05:40:45 PM »
OK, I see /sbin/poweroff is the power down command.

I don't know about the [ /] syntax I just modified the default event file.
big pc man

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #14 on: November 18, 2009, 06:11:25 PM »
I don't know about the [ /] syntax I just modified the default event file.
Ah, just remembered I read something yesterday at http://freeos.com/guides/lsst/ch02sec11.html that it means either a space or a slash.