diff --git a/hald/linux/acpi.c b/hald/linux/acpi.c index 3798f67..749931a 100644 --- a/hald/linux/acpi.c +++ b/hald/linux/acpi.c @@ -137,12 +137,7 @@ battery_refresh_poll (HalDevice *d) * * full details here: http://bugzilla.gnome.org/show_bug.cgi?id=309944 */ - if (reporting_unit && strcmp (reporting_unit, "mWh") == 0) { - /* units do not need conversion */ - normalised_current = reporting_current; - normalised_lastfull = reporting_lastfull; - normalised_rate = reporting_rate; - } else if (reporting_unit && strcmp (reporting_unit, "mAh") == 0) { + if (reporting_unit && strcmp (reporting_unit, "mAh") == 0) { /* convert mAh to mWh by multiplying by voltage. due to the * general wonkiness of ACPI implementations, this is a lot * harder than it should have to be... @@ -160,10 +155,10 @@ battery_refresh_poll (HalDevice *d) if (design_voltage <= 0) design_voltage = 1000; /* mV */ - /* If the current voltage is unknown or greater than design, - * then use design voltage. + /* If the current voltage is unknown, 1 mV (fd.o #8593) or greater than + * design, then use design voltage. */ - if (voltage <= 0 || voltage > design_voltage) + if (voltage <= 1 || voltage > design_voltage) voltage = design_voltage; normalised_current = (reporting_current * voltage) / 1000; @@ -171,7 +166,7 @@ battery_refresh_poll (HalDevice *d) normalised_rate = (reporting_rate * voltage) / 1000; } else { /* - * handle as if mWh, which is the most common case. + * handle as if mWh (which don't need conversion), which is the most common case. */ normalised_current = reporting_current; normalised_lastfull = reporting_lastfull;