WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #15 on: November 18, 2009, 03:14:51 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.
Not at my PC now, what's in "exitcheck.sh"?

Offline Kingdomcome

  • Sr. Member
  • ****
  • Posts: 286
Re: How to use acpid?
« Reply #16 on: November 18, 2009, 04:46:01 PM »
exitcheck.sh is a script written by roberts that is the backend for the exittc gui (although the comments at the head of the script still reference the dsl days)  You can view it at /usr/bin/exitcheck.sh. Basically you can call it with no options or with "exitcheck.sh shutdown" and it will backup then shutdown.  You can also backup and reboot by running "exitcheck.sh reboot"

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #17 on: November 19, 2009, 02:07:13 PM »
Well. Last night I decided to use the microcore new release candidate for a test drive and installed it on a partition along with other stuff.

And I just could not get the power button to operate. As far as I could see I am doing everything identically. The only difference is the rc version (rc2 vs rc1a) and using mc_rc2 vs tc_rc1a.

The lid button action works but sleep and power is steadfastly being ignored.

Very frustrating that something works in one case but the same thing does not in another case.

Offline Kingdomcome

  • Sr. Member
  • ****
  • Posts: 286
Re: How to use acpid?
« Reply #18 on: November 19, 2009, 06:19:02 PM »
That probably has something to do with the other acpi errors mentioned in the rc threads.  If you had this working in TC2.5, I would expect to be able to work in 2.6final, but we'll have to see what roberts comes up with.

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #19 on: November 20, 2009, 04:13:26 PM »
Well I'm almost ready to give up. What worked before, for no reason I know, no longer works.

I desperately need some help: How would I detect button identifiers? I need a script that would display button IDs on screen or to a file but I am out of my depth here.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to use acpid?
« Reply #20 on: November 20, 2009, 04:55:42 PM »
Well I'm almost ready to give up. What worked before, for no reason I know, no longer works.

I desperately need some help: How would I detect button identifiers? I need a script that would display button IDs on screen or to a file but I am out of my depth here.

To display button information I  modified the action script to echo a message to a test file. I think it was something simple like "echo $1 > test" but I don't remember for sure.

You could try this as mentioned in http://www.gentoo.org/doc/en/power-management-guide.xml and http://wiki.archlinux.org/index.php/Acpid#Sample_Events:

Quote
Catching ACPI events with the help of acpid. First you need to know which events are generated when the power source changes. The events are called ac_adapter and battery on most laptops, but it might be different on yours.

Code Listing 2.6: Determining ACPI events for changing the power source

# tail -f /var/log/messages | grep "received event"

Run the command above and pull the power cable. You should see something like this:

Code Listing 2.7: Sample output for power source changes

[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000"
[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001"

The interesting part is the quoted string after received event. It will be matched by the event line in the files you are going to create below.
« Last Edit: November 20, 2009, 05:35:15 PM by bigpcman »
big pc man

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #21 on: November 20, 2009, 08:31:00 PM »
To display button information I  modified the action script to echo a message to a test file. I think it was something simple like "echo $1 > test" but I don't remember for sure.
Thanks, that's what I needed to know. It's very hard stumbling around, trying to read and absorb all the stuff on the web, not being sure if it is applicable or not. :)

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #22 on: November 22, 2009, 01:25:32 PM »
I am getting repeatable results now. I rewrote my scripts from scratch; I am wondering if my script name cause all my trouble - power.sh. I don't know, but it steadfastly refused to execute that script after initial promising results. I now have just one events file and one actions file with different names. And the power button now works.

Except I still am completely unable to call exittc from my scripts. exitcheck.sh works but I have never seen exittc start up via my script, even though it works just fine when called from the usual other places. I have given up on that one.


Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to use acpid?
« Reply #23 on: November 22, 2009, 04:56:10 PM »
I am getting repeatable results now. I rewrote my scripts from scratch; I am wondering if my script name cause all my trouble - power.sh. I don't know, but it steadfastly refused to execute that script after initial promising results. I now have just one events file and one actions file with different names. And the power button now works.

Except I still am completely unable to call exittc from my scripts. exitcheck.sh works but I have never seen exittc start up via my script, even though it works just fine when called from the usual other places. I have given up on that one.



I wonder if you copied exittc to your /home/tc directory, made the file executable and perhaps renamed it if then it would execute. Kind of a brute force test that sorts things out a bit.
big pc man

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10981
Re: How to use acpid?
« Reply #24 on: November 29, 2009, 03:52:16 AM »
Since you run acpid as root, it can't start it on user tc's display - X security.

su tc -c "exittc"

Would run it as user tc, which should work.
The only barriers that can stop you are the ones you create yourself.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14624
Re: How to use acpid?
« Reply #25 on: November 29, 2009, 03:57:46 AM »
I was wondering about that - I just used a simple power button event and script to test the latest update to acpid.

Calling exittc, I got a segmentation fault, but calling exitcheck.sh was OK - I can see why now.

BTW, I'm sure I tried "su tc" before and it didn't work...

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to use acpid?
« Reply #26 on: November 29, 2009, 07:40:24 AM »
Since you run acpid as root, it can't start it on user tc's display - X security.

su tc -c "exittc"

Would run it as user tc, which should work.

Interesting.

For those that wonder what the "-c" option does:

"Among the most commonly used of su's few options is -c, which tells su to execute the command that directly follows it on the same line. Such command is executed as the new user, and then the terminal window or console from which su was run immediately returns to the account of the former user after the command has completed execution or after any program that it has launched has been closed.

If the command inclusive of its options has one or more spaces in it, then it must be enclosed in quotation marks; otherwise, su will interpret whatever comes after the first space in the command as the name of a user to whose account su is supposed to switch (the result of which will be an error message). "
big pc man

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: How to use acpid?
« Reply #27 on: December 01, 2009, 05:26:28 AM »