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 340403 - vertical axis in power history plot
vertical axis in power history plot
Status: RESOLVED NOTGNOME
Product: gnome-power-manager
Classification: Deprecated
Component: gnome-power-manager
SVN TRUNK
Other Linux
: Normal normal
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2006-05-02 14:13 UTC by William Jon McCann
Modified: 2006-08-31 07:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (88.43 KB, image/png)
2006-05-02 14:14 UTC, William Jon McCann
  Details
lshal output (110.69 KB, text/plain)
2006-05-02 17:58 UTC, William Jon McCann
  Details
temp fix for spacing issue (1.33 KB, patch)
2006-05-02 18:08 UTC, William Jon McCann
none Details | Review
patch that's been reported to work (2.66 KB, patch)
2006-05-24 12:31 UTC, Richard Hughes
none Details | Review

Description William Jon McCann 2006-05-02 14:13:54 UTC
The vertical axis in power history plot seems a little strange.
Comment 1 William Jon McCann 2006-05-02 14:14:48 UTC
Created attachment 64665 [details]
screenshot

The labels at least seem out of order.
Comment 2 Richard Hughes 2006-05-02 17:12:29 UTC
You're using 0.5kW of power! That must be one hell of a laptop.

Seriously tho, what are the values from "lshal |grep rate" when you get these crazy numbers?

Richard.
Comment 3 William Jon McCann 2006-05-02 17:18:38 UTC
lshal|grep rate
  battery.charge_level.rate = 27572400  (0x1a4b8b0)  (int)
  battery.reporting.rate = 2484  (0x9b4)  (int)
Comment 4 William Jon McCann 2006-05-02 17:31:31 UTC
Ok, so they aren't out of order but rather truncated (I added a gpm_debug):
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 26190W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 23571W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 20952W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 18333W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 15714W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 13095W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 10476W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 7857W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 5238W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 2619W
[gpm_graph_draw_labels] gpm-graph-widget.c:439 (13:30:25):       LABEL: 0W
Comment 5 Richard Hughes 2006-05-02 17:36:27 UTC
Odd. Those are some big numbers. g-p-m reads battery.reporting.rate and uses the fact that it's normalised to mWh. Is this a multibattery machine? Can you post a full g-p-m --verbose --no-daemon log pls.

Thanks.
Comment 6 Richard Hughes 2006-05-02 17:54:16 UTC
Sorry, I meant g-p-m reads battery.charge_level.rate as this is the normalised value. HAL is feeding us invalid info. Can you provide complete lshal pls.

Thanks.
Comment 7 William Jon McCann 2006-05-02 17:58:07 UTC
Created attachment 64677 [details]
lshal output
Comment 8 William Jon McCann 2006-05-02 18:00:10 UTC
So, I suppose there are two problems.

1. bogus values
2. not allocating enough space for the values in the widget

Even though these are admittedly bogus we should probably make sure they can fit even if only for more accurate bug reports.
Comment 9 William Jon McCann 2006-05-02 18:08:06 UTC
Created attachment 64680 [details] [review]
temp fix for spacing issue

I think the correct fix would be to get the max extent of the y axis labels and adjust ->box_x for that but that seems a little tricky.  This is a simple workaround just by making the box_x a bit large but still hardcoded.

This also formats the labels as kW when they are above 900W.  Sure may never be needed but then again it was for me.
Comment 10 Richard Hughes 2006-05-02 19:34:17 UTC
No, please don't apply this. The proper fix is to compute the proper width of the labels, which I can do easily as i've done this in other places.

We should really work on the hal fix:

hald/linux/acpi.c:

...
if (reporting_unit && strcmp (reporting_unit, "mAh") == 0) {
	voltage_design = hal_device_property_get_int (d, "battery.voltage.design");
	
	/* If design voltage is unknown, use 1mV. */
	if (voltage_design <= 0)
		voltage_design = 1;

	/* scale by factor battery.voltage.design */
	hal_device_property_set_int (d, "battery.charge_level.design",
		reporting_design * voltage_design);
	hal_device_property_set_int (d, "battery.charge_level.warning",
		reporting_warning * voltage_design);
	hal_device_property_set_int (d, "battery.charge_level.low",
		reporting_low * voltage_design);
	hal_device_property_set_int (d, "battery.charge_level.granularity_1",
		reporting_gran1 * voltage_design);
	hal_device_property_set_int (d, "battery.charge_level.granularity_2",
		reporting_gran2 * voltage_design);

	/* set unit */
	hal_device_property_set_string (d, "battery.charge_level.unit",
		"mWh"); /* not mAh! */
	}

this is wrong IMO.

You have battery.voltage.design in mV (11100)
You have battery.reporting.rate in mAh (2187)

We are currently multiplying to give:

mWh = mAh * mV

when we should be doing:

mWh = mAh * ( mV / 1000)

Does that make sense? Could you try patching HAL and seeing if that works for you please.

Richard.
Comment 11 Allison Karlitskaya (desrt) 2006-05-02 23:20:50 UTC
The values that HAL reports are in no particular unit.  It's wrong to assume that they might be.
Comment 12 Richard Hughes 2006-05-04 16:38:28 UTC
So we should remove the property in hal that tells us that it's mWh..
Comment 13 Richard Hughes 2006-05-24 12:31:22 UTC
Created attachment 66121 [details] [review]
patch that's been reported to work

You might want to try the attached patch as it's been reported as working fine.
Comment 14 Richard Hughes 2006-08-10 11:27:47 UTC
Closing as this will remain broken until HAL is patched.
Comment 15 Richard Hughes 2006-08-31 07:39:42 UTC
My patch has been applied to HAL. The soon-to-be-released version 0.5.8 will contain this fix and should fix the issues with values being too large.