Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: jur on November 15, 2009, 05:03:01 AM
-
When I try to use acpid, I get
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?
-
Is acpid already running maybe? What is the result of "ps aux | grep acpid"?
-
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.
-
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.
-
You could have a look at this thread for some acpi info:
http://forum.tinycorelinux.net/index.php?topic=2813.msg14648#msg14648 (http://forum.tinycorelinux.net/index.php?topic=2813.msg14648#msg14648)
-
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
-
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? ???
-
* bump *
-
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.
-
I have been able to get acpid running by adding
sudo killall acpid
sudo acpidto the .xsession file.
The power button event calls an action file
#!/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.
-
I have been able to get acpid running by adding
sudo killall acpid
sudo acpidto the .xsession file.
The power button event calls an action file
#!/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.
Event file code
power
event=button[ /]power
action=/etc/acpi/actions/power.sh "%e"
power.sh code
#! /bin/sh
#
exittc
-
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.
-
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".
This is what I have but I'm running this on mc2.2.
Event file code
power
event=button[ /]power
action=/etc/acpi/actions/power.sh "%e"
power.sh code
#! /bin/sh
#
exittc
My code is identical except I haven't got "[ /]", only "/" - what's the difference?
-
OK, I see /sbin/poweroff is the power down command.
I don't know about the [ /] syntax I just modified the default event file.
-
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.
-
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"?
-
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"
-
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.
-
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.
-
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.
-
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 (http://www.gentoo.org/doc/en/power-management-guide.xml) and http://wiki.archlinux.org/index.php/Acpid#Sample_Events (http://wiki.archlinux.org/index.php/Acpid#Sample_Events):
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.
-
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. :)
-
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 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.
-
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.
-
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...
-
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). "
-
I have started a wiki for using acpid:
http://wiki.tinycorelinux.com/tiki-index.php?page=Using+acpid+to+control+your+PC+buttons