g-p-m does not allow using battery percentage for policy in feisty
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gnome-power-manager (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: gnome-power-manager
In my experience, it does not seem to be possible to get g-p-m to use battery percent remaining, rather than battery time remaining, as the metric determining the current power state.
Steps to reproduce:
1. open gconf-editor
2. navigate to /apps/gnome-
3. uncheck key "use_time_
4. set key "battery_
5. set key "action_
6. unplug your laptop. The machine should suspend within a few minutes, when the battery percentage drops from 100% to 99%.
7. observe as the laptop does not suspend.
If my source-diving is correct, this is due to a line in gpm_warning_
we initialize policy to warning-
Then, we compare policy to GPM_WARNING_TIME, and since policy == 0 == GPM_WARNING_TIME,
we go into the body of the if statement, and begin checking status-
90 /* get from gconf */
91 if (policy == GPM_WARNING_AUTO) {
92 policy = warning-
93 }
94
95 /* this is a CSR mouse */
96 if (status-
--- SNIP ---
102 } else if (policy == GPM_WARNING_TIME) {
103 if (status-
104 type = GPM_WARNING_NONE;
105 } else if (status-
106 type = GPM_WARNING_ACTION;
107 } else if (status-
108 type = GPM_WARNING_
109 } else if (status-
110 type = GPM_WARNING_
111 } else if (status-
112 type = GPM_WARNING_LOW;
113 }
114 } else {
115 if (status-
I don't know the Gnome style conventions, but I think that the most readable fix would be to change
policy = warning-
to
if ( warning-
policy = GPM_WARNING_TIME;
else
policy = GPM_WARNING_
I realized the same thing with gpm on ubuntu and archlinux. So I wrote my own patch to ensure explicit checking of the gconf use_time_for_policy in gpm-manager.c. The patch is attached. The devs can pick it up or you could apply it on your own