diff options
author | Landry Breuil <landry@rhaalovely.net> | 2012-01-04 11:32:21 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2012-01-06 13:40:50 +0000 |
commit | 37ff0d4ddba334cded96973424dd790459b50be1 (patch) | |
tree | be5a689969fcf475062cc9fe277b11ea335941ba /src | |
parent | 60e474ead5db1d8be3ee542caf40fb08650353b1 (diff) |
openbsd: fix energy-rate calculation
since acpibat.c r1.59, bst_rate type is SENSOR_AMPS or SENSOR_WATTS
and value has been corrected. Tweak accordingly.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/openbsd/up-backend.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/openbsd/up-backend.c b/src/openbsd/up-backend.c index 35ed284..cf11a3b 100644 --- a/src/openbsd/up-backend.c +++ b/src/openbsd/up-backend.c @@ -375,8 +375,10 @@ up_backend_update_acpibat_state(UpDevice* device, struct sensordev s) typev = sens.type; bst_cap = sens.value / 1000000.0f; } - if (sens.type == SENSOR_INTEGER && !strcmp(sens.desc, "rate")) - bst_rate = sens.value / 1000.0f; + if ((sens.type == SENSOR_AMPS || sens.type == SENSOR_WATTS) && !strcmp(sens.desc, "rate")) { + typev = sens.type; + bst_rate = sens.value / 1000000.0f; + } /* bif_dvolt = "voltage" = unused ? capacity = lastfull/dcap * 100 ? @@ -386,7 +388,7 @@ up_backend_update_acpibat_state(UpDevice* device, struct sensordev s) } } } - if (typev == SENSOR_AMPHOUR) { + if (typev == SENSOR_AMPHOUR || typev == SENSOR_AMPS) { bst_cap *= bst_volt; bif_lowcap *= bst_volt; bif_lastfullcap *= bst_volt; |