Should battery generate events?
Hi,
Last week my laptop (Acer Travelmate 636Lci) run out of power resulting in a unclean shutdown, disk corruption and me spending a few evenings to get it to sanely work again.
I would want to avoid this happening again. Ideally I would want my laptop to "shutdown -h now" if battery power is to low (well rather have it go to S3 or softwaresuspend, but it seems hopeless to get that to work :(
Quoted 1 line
From some googl'ing I get the impression that ACPI should generate
battery events on a change of capacity or at least when it's low. My idea was to have acpid call some script on battery events. The problem is that there doesn't seem to be such events on my machine.
Should every bios generate these events?
Could it be a bug in my DSDT?
Does it have anything to do with
tdykstra@bonenpikster:/$ cat /proc/acpi/battery/BAT0/alarm alarm: unsupported ?
FYI from my /proc/acpi:
tdykstra@bonenpikster:/$ cat /proc/acpi/battery/BAT0/state present: yes capacity state: ok charging state: charging present rate: unknown remaining capacity: 3840 mAh present voltage: 14800 mV tdykstra@bonenpikster:/$ cat /proc/acpi/battery/BAT0/info present: yes design capacity: 3920 mAh last full capacity: 3920 mAh battery technology: rechargeable design voltage: 14800 mV design capacity warning: 30 mAh design capacity low: 20 mAh capacity granularity 1: 10 mAh capacity granularity 2: 3470 mAh model number: Bat0 serial number: battery type: Lion OEM info: Acer
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Tim Dijkstra
Hi,
Last week my laptop (Acer Travelmate 636Lci) run out of power resulting in a unclean shutdown, disk corruption and me spending a few evenings to get it to sanely work again.
Quoted 10 lines
I would want to avoid this happening again. Ideally I would want my laptop to "shutdown -h now" if battery power is to low (well rather have it go to S3 or softwaresuspend, but it seems hopeless to get that to work :(
Quoted 1 line
From some googl'ing I get the impression that ACPI should generate
battery events on a change of capacity or at least when it's low. My
idea was to have acpid call some script on battery events. The problem is that there doesn't seem to be such events on my machine.
Whenever polling is required, this is expected to be done in userspace, not in kernelspace. There's a long history of people asking "why doesn't battery status changes generate events" and a long history of people saying "because it would require polling in either acpid or the kernel, which is a Bad Thing(tm)".
If you'd like something to watch the battery capacity, perhaps you should use something like KLaptop -- you can configure it to run a command (like 'echo -n "disk" > /sys/power/state') on low and/or on critical battery level warnings. Since it tracks this kind of state, you don't have to.
Of course, KLaptop's not the only option -- it's just what I have here.
David Bronaugh
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · On Mon, 04 Oct 2004 15:14:45 -0700 David Bronaugh…
Quoted 7 lines · Tim Dijkstra
From some googl'ing I get the impression that ACPI should generate battery events on a change of capacity or at least when it's low. My idea was to have acpid call some script on battery events. The problem is that there doesn't seem to be such events on my machine.
Quoted 5 lines
Whenever polling is required, this is expected to be done in userspace, not in kernelspace. There's a long history of people asking "why doesn't battery status changes generate events" and a long history of people saying "because it would require polling in either acpid or the kernel, which is a Bad Thing(tm)".
Hmm, sounds reasonable ... But what do these entries in /proc/acpi/battery/BAT0/info mean:
design capacity warning: 30 mAh design capacity low: 20 mAh
it seems to imply to me that there should be a warning of some kind when the capacity hits 30 mAh. But if I read your post correctly there is no such thing?
Quoted 4 lines
If you'd like something to watch the battery capacity, perhaps you should use something like KLaptop -- you can configure it to run a command (like 'echo -n "disk" >
/sys/power/state') on low and/or on critical battery level warnings.
Yeah, but several people log in on this laptop (wife, kid (well not yet), brothers, sister ...) and that means I have to set up their desktops and hope they don't accidentally disable it. It seemed a much cleaner solution to have a gui/user independent process handle it.
It seems I have to hack a little script that polls the battery status ones in a while and takes appropriate action...
grts Tim
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 21 lines · On Tue, 5 Oct 2004 20:28:44 +0200 Tim Dijkstra…
Quoted 9 lines · On Mon, 04 Oct 2004 15:14:45 -0700 David Bronaugh…
Quoted 7 lines · Tim Dijkstra
From some googl'ing I get the impression that ACPI should generate battery events on a change of capacity or at least when it's low. My idea was to have acpid call some script on battery events. The problem is that there doesn't seem to be such events on my machine.
Quoted 5 lines
Whenever polling is required, this is expected to be done in userspace, not in kernelspace. There's a long history of people asking"why doesn't battery status changes generate events" and a long history of people saying "because it would require polling in either acpid or the kernel, which is a Bad Thing(tm)".
Hmm, sounds reasonable ... But what do these entries in
/proc/acpi/battery/BAT0/infomean:
Quoted 6 lines
design capacity warning: 30 mAh design capacity low: 20 mAhit seems to imply to me that there should be a warning of some kind when the capacity hits 30 mAh. But if I read your post correctly there is no such thing?
Replying to my self here ...
Readying the ACPI spec I learned there _is_ such a thing, but it's not required. And browsing through my dsdt I see there's no _BTP method, which probably means my battery doesn't support that:( After reading battery.c I can further reply to myself in my first post:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Does it have anything to do with
tdykstra@bonenpikster:/$ cat /proc/acpi/battery/BAT0/alarm alarm: unsupported
Yes, this means there's no _BTP and hence no warning events.
So polling is the only option for me ...
grts Tim
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
Quoted 4 lines · Tim Dijkstra
I would want to avoid this happening again. Ideally I would want my laptop to "shutdown -h now" if battery power is to low (well rather have it go to S3 or softwaresuspend, but it seems hopeless to get that to work :(
Well, there are user space tools that will do this for you. SUSE provides powersaved which will poll your battery if it doesn't support events and take apropriate action (default is shutdown if battery is <2%). It is also caching the data so that your battery applet does not have to poll the battery by itself (which is ridiculously expensive on many machines) but it only has to ask powersaved.
Regarding suwsusp: this should work on most i386 machines out of the box with upcoming SUSE 9.2.
Quoted 4 lines
From some googl'ing I get the impression that ACPI should generate battery events on a change of capacity or at least when it's low. My idea was to have acpid call some script on battery events. The problem is that there doesn't seem to be such events on my machine.
well, if you had bought a (e.g.) hp nx5000 you would get events for every charge state change (every remaining capacity change, not only alarms). On the Dell D600, i get at least alarms but have to poll the battery for the actual level and on acer you get nothing. Go bug acer.
Signature · 9 lines
Stefan Seyfried ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): 20041008161046.GC10581-l0tNAEGuAhhzZ8+rp42Dbp9+tswZ0GTaehPwdyo5hKaELgA04lAiVw@public.gmane.org
Quoted 7 lines · On Fri, 8 Oct 2004 18:10:46 +0200 Stefan Seyfried…
Quoted 4 lines · Tim Dijkstra
I would want to avoid this happening again. Ideally I would want my laptop to "shutdown -h now" if battery power is to low (well rather have it go to S3 or softwaresuspend, but it seems hopeless to get that to work :(
Quoted 7 lines
Well, there are user space tools that will do this for you. SUSE provides powersaved which will poll your battery if it doesn't support events and take apropriate action (default is shutdown if battery is <2%). It is also caching the data so that your battery applet does not have to poll the battery by itself (which is ridiculously expensive on many machines) but it only has to ask powersaved.
I could not find a lot about it on the web, then downloaded the src rpm from suse. Looks interesting ... I do not use suse myself but maybe I can get (parts of it) to work on my system.
Quoted 2 lines
Regarding suwsusp: this should work on most i386 machines out of the box with upcoming SUSE 9.2.
I find that a bold statement if I look at the number of posts to this and the swsusp2 list in which people tell they can't get suspend to work.
grts Tim
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Tim Dijkstra
On Fri, 8 Oct 2004 18:10:46 +0200
I could not find a lot about it on the web, then downloaded the src rpm from suse. Looks interesting ... I do not use suse myself but maybe I can get (parts of it) to work on my system.
we are currently working on getting it more portable, it is pretty SUSE-centric right now but this should change soon. If it builds and runs on other distributions, tarballs and packages will be available from forge.novell.com (the CVS is hosted there).
Quoted 6 lines
Quoted 2 lines
Regarding suwsusp: this should work on most i386 machines out of the box with upcoming SUSE 9.2.
I find that a bold statement if I look at the number of posts to this and the swsusp2 list in which people tell they can't get suspend to work.
It worked at least on every i386 notebook i could get my hands on during beta and that were a lot of machines. I did not test many desktops (i don't have many of them :-) but i really believe it should work out of the box on most i386 notebooks. Of course there are known show-stoppers like the binary NVidia drivers but these should fail gracefully and there is not much we can do about them.
Signature · 9 lines
Stefan Seyfried ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
Hi!
Quoted 6 lines
Quoted 2 lines
Regarding suwsusp: this should work on most i386 machines out of the box with upcoming SUSE 9.2.
I find that a bold statement if I look at the number of posts to this and the swsusp2 list in which people tell they can't get suspend to work.
SuSE 9.2 uses swsusp1, similar to version in 2.6.9-rc4, with some support in userland (module unloading). It tends to work very well.
Pavel
Signature · 9 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl! ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Salut Tim,
Quoted 10 lines · Tim Dijkstra
Quoted 5 lines · On Tue, 5 Oct 2004 16:25:58 +0200 (CEST)…
But do you allways run X (i.e. a graphical desktop)? ...because most monitoring applications are graphics driven: There are some solutions that come with KDE and I had a look (some time ago) at kacpi... One problem might be, that your DSDT does not calculate a "present rate".
It does show the correct state while discharging, so that's not the problem.
Sorry, but I doubt that, or you do not have the latest BIOS - and the introduced this later. The DSDT from r01c0O-BIOS for TM 63x does allways say, that the "present-rate" is unknown. But that does not mean, that there is no solution for you - just that you might run into problems, with other's solution, that depend on a defined present-rate
Quoted 3 lines
I just wouldn't want to depend on an gui. Several people can use this machine, and I do not want to configure their desktops and hope they keep it like that.
ok. that would be a cleaner solution. But if you like to nag them, when the state drops to "warning", you might want to popup an xterm or other x-window. To do that you need to steal the .Xauthority (cookie) from the one running the X-server; because root does not have access in a normal setup. Just as a hint.
Quoted 6 lines
Quoted 3 lines
If you do not use the proprietary Nvidia-X driver, swsusp2 worked for me. But as the Nvidia-driver is so much faster, I am not able to do a software-suspend too.
I do use the nvidia drivers, but even without X running it won't suspend successfully. Did you do anything special to get it to work?
Sorry, it was a bit ago, when I last tried it. I took the swsusp2-patches and the latest 2.6-kernel.
If you do experiments with this, be sure to always do a "sync" right as the last command, before you try to susupend. This increases the likeliness, that the fsck (in case it crashed) to fix it automatically without you loosing data. But I said "likeliness". Hope you got the tune with this.
Cheers
hartwig felger
Hartwig Felger informatics
- -- 1024D/339FD693 Hartwig Felger <[email protected]> Key fingerprint = FB2F 3EE9 345A D55B 6FF2 0EC1 F5B0 684F 339F D693 For the pulic keys, please visit my page.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFBYxAf9bBoTzOf1pMRAk/AAJ93GLK0QKd4SdccQ1GnQpb/tN1XFwCg7l8G 9OTMFduJAgmm4ElEEwDZuDM=
=I2jH
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.60.0410052308181.5157-KnfdeQs3A3X/[email protected]
Quoted 11 lines · On Tue, 5 Oct 2004 23:20:22 +0200 (CEST)…
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Salut Tim,
Quoted 3 lines · Tim Dijkstra
On Tue, 5 Oct 2004 16:25:58 +0200 (CEST)
It does show the correct state while discharging, so that's not the problem.Sorry, but I doubt that, or you do not have the latest BIOS - and the introduced this later. The DSDT from r01c0O-BIOS for TM 63x does allways say, that the "present-rate" is unknown.
Ah, yes present rate is always unknown, but what seemed more important to me is 'remaining capacity', that does represents a usefull value. Also the ACPI spec says that the battery/bios could signal that the battery is almost empty by generating an event if capacity goes under a certain value (see other mail from me in this thread).
grts TIm
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl