After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332055 - g-p-m doesn't suspend when power is critical
g-p-m doesn't suspend when power is critical
Status: RESOLVED FIXED
Product: gnome-power-manager
Classification: Deprecated
Component: gnome-power-manager
SVN TRUNK
Other All
: Normal critical
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2006-02-21 16:46 UTC by alejandro vera
Modified: 2006-02-25 12:30 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
Warning at 3% (17.07 KB, image/png)
2006-02-22 04:59 UTC, alejandro vera
  Details
test patch (571 bytes, patch)
2006-02-22 09:59 UTC, Richard Hughes
none Details | Review

Description alejandro vera 2006-02-21 16:46:21 UTC
Please describe the problem:
I am using the new version (CVS, yesterday) of g-p-m and configured to suspend
my system when power is critical

A lot time later (my battery last 5 hours :) ) i saw g-p-m warning that my
battery was really low (3%). I waited and some minutes later my battery died and
i lost all my data :(

Steps to reproduce:
1. configure gnome-power-preferences to suspend in critical battery 
2. wait till battery runs uot



Actual results:
the battery dies

Expected results:
the computer should sleep

Does this happen every time?
yes

Other information:
Comment 1 alejandro vera 2006-02-21 16:47:30 UTC
I forgot to say something....

If i press "suspend" in g-p-m, the system suspends normally... it works great manually and when i close the lid
Comment 2 Richard Hughes 2006-02-21 17:05:22 UTC
Did your computer "die" at 3% charge, or did it make it to 0%?
Comment 3 alejandro vera 2006-02-21 17:42:17 UTC
I keep looking at the tooltip and it went 3% -> 2% -> 0% ...satyed that way a couple of minutes and then it died.. 

BTW: the title of the bug says shutdown.. it should be suspend... can you fix it?
Comment 4 Richard Hughes 2006-02-21 18:21:53 UTC
At 3%, what was the time-to-discharge value? What was it's value (aprox) at 2%, 1%, etc.
Comment 5 alejandro vera 2006-02-21 18:24:56 UTC
I don't remeber... i discharge my batt again to try it ... in a cuople of hours I answer that...

I think it was somthing like 5 minutes....
Comment 6 alejandro vera 2006-02-22 04:58:17 UTC
I took a screenshot at 3% :D

I'll attach to the bug... 

It was 9 minutes at 3%

Comment 7 alejandro vera 2006-02-22 04:59:47 UTC
Created attachment 59900 [details]
Warning at 3%
Comment 8 Richard Hughes 2006-02-22 09:59:55 UTC
Created attachment 59920 [details] [review]
test patch

Alejandro, can you try the attached patch please?

If that doesn't work, can you open src/gpm-manager.c, and change the values:

#define		BATTERY_LOW_PERCENTAGE			(10)	  /* 10 percent */
#define		BATTERY_VERY_LOW_PERCENTAGE		(5)	  /* 5 percent  */
#define		BATTERY_CRITICAL_PERCENTAGE		(2)	  /* 2 percent  */
#define		BATTERY_ACTION_PERCENTAGE		(1)	  /* 1 percent  */

#define		BATTERY_LOW_REMAINING_TIME		(20 * 60) /* 20 minutes */
#define		BATTERY_VERY_LOW_REMAINING_TIME		(10 * 60) /* 10 minutes */
#define		BATTERY_CRITICAL_REMAINING_TIME		(5 * 60)  /* 5 minutes  */
#define		BATTERY_ACTION_REMAINING_TIME		(2 * 60)  /* 2 minutes  */

to something more suitable for your super-large battery. We can do clever things automatically when can we parametise your battery.

Richard.
Comment 9 alejandro vera 2006-02-22 16:12:32 UTC
Hello Richard

I tried the patch and observed

My battery have 30 left at 10% and 6 minutes at 2%

When it reached 5 minutes left, it suspended my notebook and worked wonderful! i didn't lost anything :D. I didnt need to change the other defaults

But I noticed something wrong... when nb was suspended, I plug the AC adaptor, then resumed the computer. When it waked up it saw that were very low power and went to suspend again... i think that there is vero low critical battery BUT the notebook is charging, then it didn't need to suspend... 

Must i fill another bug or that is the apropiate behavior???

Thanks again for the patch. 
Comment 10 Richard Hughes 2006-02-22 16:37:48 UTC
Alejandro, I'm glad the patch worked, but this probably needs more discussion about the defaults. It would appear that your battery does not report the correct time exactly, but does report the correct percentage, as I'm sure you'll notice  by the comment in the source. At the very least, we need to make this a gconf configurable.

As for the other problem, can you open a new bug please, thanks.
Comment 11 Richard Hughes 2006-02-24 16:54:39 UTC
I've committed this to CVS:

2006-02-24  Richard Hughes  <richard@hughsie.com>
 * data/gnome-power-manager.schemas.in: Add the new key: /apps/gnome-power-manager/use_time_for_policy to set the policy for per-time or per-percentage critical and low power actions.
 * src/gpm-prefs.h: Add GPM_PREF_USE_TIME_POLICY
 * src/gpm-manager.c (gpm_manager_init): set the per-time policy type from GPM_PREF_USE_TIME_POLICY. This still needs to be documented. Fixes #332055.

Closing this bug. If it's wrong, or doesn't work, can you re-open please.
Comment 12 alejandro vera 2006-02-25 11:15:56 UTC
Hello Richard

That is a key in gconf? how to i change it? in gconf-editor i didnt find it... i still change the relevant line in the source ...


Thanks for the wonderful job... and for solving bugs...

i've commited bugs in other project and almost no one ever fix the problem... you code fast :D
Comment 13 Richard Hughes 2006-02-25 11:38:07 UTC
>Thanks for the wonderful job

Thanks, that means a lot. You can get pretty low sometimes when you get 20+ emails a day about people with problems with your code!

>you code fast :D

Blessing and a curse :-)

Try this, it manually creates the key:

gconftool-2 --type bool --set /apps/gnome-power-manager/use_time_for_policy false

This should be automatic, but isn't until you install a packaged version. You probably havn't got the newest schema installed, which is done automatically when you install a packaged version of g-p-m. You can manually install them with gconftool-2, and I don't remember the exact commands, but google will :-)

For now, the manual --set command should work well.

Richard.
Comment 14 alejandro vera 2006-02-25 12:30:53 UTC
Hi... it work'd :D

I use a packaged version (deb, made my own) but i didnt know where to look :D

Well... i think it closes the bug...