Package: powertop Version: 1.10-1 Followup-For: Bug #486873 Hi, I have exatly the same problem like the one reported in this issue. After some discussion with battery kernel module it seems that some batteries don't export energy_now attribute and export only charge_now value. Nevertheless energy can be calculated as energy = voltage * charge_now
The patch below is working for me, however I have still some problems that powertop provides weird values for consumption with 2.6.25-2 distribution kernel. I have no problems with Vanilla 2.6.25, 2.6.26 kernel, though. You can follow ongoing discussion on lkml (http://lkml.org/lkml/2008/7/21/455 and powertop mailing list) -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.26 (SMP w/2 CPU cores) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Shell: /bin/sh linked to /bin/bash Versions of packages powertop depends on: ii libc6 2.7-10 GNU C Library: Shared libraries ii libncursesw5 5.6+20080308-1 Shared libraries for terminal hand powertop recommends no packages. -- no debconf information --- From: [EMAIL PROTECTED] Subject: [PATCH] use charge_now when energy_now is not present Some batteries (like one in the Futjitsu Siemens Lifebook S71110) don't export energy_now attribute and exports only change_now in the power_supply sys directory. However, we can use this value when it is multiplied by current voltage. Signed-off-by: Michal Hocko <[EMAIL PROTECTED]> --- a/powertop.c 2008-07-21 10:35:10.000000000 -0600 +++ b/powertop.c 2008-07-21 10:36:03.000000000 -0600 @@ -630,11 +630,19 @@ void print_battery_sysfs(void) sprintf(filename, "/sys/class/power_supply/%s/energy_now", dirent->d_name); file = fopen(filename, "r"); - if (!file) - continue; + watts_left = 1; + if (!file) { + sprintf(filename, "/sys/class/power_supply/%s/charge_now", dirent->d_name); + file = fopen(filename, "r"); + if (!file) + continue; + + /* W = A * V */ + watts_left = voltage; + } memset(line, 0, 1024); if (fgets(line, 1024, file) != NULL) { - watts_left = strtoull(line, NULL, 10) / 1000000.0; + watts_left *= strtoull(line, NULL, 10) / 1000000.0; } fclose(file); -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]