----- Original Message ----- > 27.02.2012 20:36, Chris Ferron kirjoitti: > > On 02/24/2012 08:50 AM, Paul Menzel wrote: > >> Dear Jaroslav, > >> > >> > >> Am Freitag, den 24.02.2012, 16:00 +0100 schrieb Jaroslav Škarvada: > >>> Proposed fix for firmwares that provides POWER_NOW instead of > >>> CURRENT_NOW. > >> thank you for the patch. Could you elaborate on the problem you > >> are > >> addressing and add maybe a link to more information about the > >> difference > >> between POWER_NOW and CURRENT_NOW? > > > > Patches applied. > > Thank You for your contribution. > > Hmm, it seems there has been some messup, AFAICS power_supply.c which > this patch changes is not used at all. > > It seems that two alternative independently written implementations > for > reading the power_supply sysfs data have been applied: > > One from John Mathew (power_supply.cpp): > https://github.com/fenrus75/powertop/commit/a1c28f69847480cc54f36046e96e93a02a2c661d > > One from me (sysfs.cpp): > https://github.com/fenrus75/powertop/commit/846b7e0a65a6958af44cb64c13de3c09cb4cd3f9 > > And as of this commit only my implementation is used (AFAICS): > https://github.com/fenrus75/powertop/commit/57d072b4c9f0048c21292a1bafcd7354886a0c9f > > With a quick look (didn't look for bugs) the only behavioural > difference > seems to be that the power_supply.cpp code doesn't seem to check if > the > battery is in "Discharging" state before reporting output, like both > acpi.cpp and sysfs.cpp do. It could trivially be added, though. > > In any case, one of the implementations should be dropped. The > implementations use very different approaches (power_supply.cpp > parses > the values from /uevent, while sysfs.cpp reads the needed values from > the individual attribute files). > > I'll leave it to you to decide which implementation should stay :) > > -- > Anssi Hannula >
Hi, in Fedora I used the former power_supply.cpp implementation and I didn't notice the switch, sorry about that. I am fine with both implementations, but currently the power_supply.cpp needs another fix: -- From 89804809816aea5e5bfb905522c8376001463b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskar...@redhat.com> Date: Wed, 7 Mar 2012 16:15:05 +0100 Subject: [PATCH] power_supply: Fix units According to linux/power_supply.h all readings are in uV, uA, uWh. Without this fix the current and voltage units were wrong, which resulted in funny readings like: http://bugzilla.redhat.com/show_bug.cgi?id=800814 --- measurement/power_supply.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/measurement/power_supply.cpp b/measurement/power_supply.cpp index f7ad964..535bb02 100644 --- a/measurement/power_supply.cpp +++ b/measurement/power_supply.cpp @@ -157,7 +157,7 @@ void power_supply::measure(void) file.close(); if(_voltage) { - _voltage = _voltage / 1000.0; + _voltage = _voltage / 1e6f; voltage = _voltage; } else { voltage = 0.0; @@ -165,10 +165,10 @@ void power_supply::measure(void) if(_power_rate) { - rate = _power_rate / 1000000.0; + rate = _power_rate / 1e6f; } else if(_current_rate) { - _current_rate = _current_rate / 1000.0; + _current_rate = _current_rate / 1e6f; rate = _current_rate * _voltage; } else { rate = 0.0; -- 1.7.7.6 _______________________________________________ Power mailing list Power@bughost.org https://bughost.org/mailman/listinfo/power