diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2012-05-28 20:14:47 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2012-05-28 20:14:47 +0000 |
commit | edec45419def1b81bd663a2859684ef55ba56269 (patch) | |
tree | caa3c2d5f4e55b38e7740a39d80a21507679c586 /community/powertop/powertop-1.13-with-3.0.6.patch | |
parent | 483f7de4ab6a706517279a24d2efc969f4a1996d (diff) |
Mon May 28 20:14:39 UTC 2012
Diffstat (limited to 'community/powertop/powertop-1.13-with-3.0.6.patch')
-rw-r--r-- | community/powertop/powertop-1.13-with-3.0.6.patch | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/community/powertop/powertop-1.13-with-3.0.6.patch b/community/powertop/powertop-1.13-with-3.0.6.patch deleted file mode 100644 index fc61913a8..000000000 --- a/community/powertop/powertop-1.13-with-3.0.6.patch +++ /dev/null @@ -1,142 +0,0 @@ -Common subdirectories: powertop-1.13/kernel-patches and powertop-patched/kernel-patches -Common subdirectories: powertop-1.13/po and powertop-patched/po -diff -u powertop-1.13/powertop.c powertop-patched/powertop.c ---- powertop-1.13/powertop.c 2010-07-20 01:08:21.000000000 +0200 -+++ powertop-patched/powertop.c 2011-10-20 14:34:41.163951192 +0200 -@@ -547,95 +547,6 @@ - qsort (lines, linehead, sizeof (struct line), line_compare); - } - -- -- --int print_battery_proc_acpi(void) --{ -- DIR *dir; -- struct dirent *dirent; -- FILE *file; -- double rate = 0; -- double cap = 0; -- -- char filename[256]; -- -- dir = opendir("/proc/acpi/battery"); -- if (!dir) -- return 0; -- -- while ((dirent = readdir(dir))) { -- int dontcount = 0; -- double voltage = 0.0; -- double amperes_drawn = 0.0; -- double watts_drawn = 0.0; -- double amperes_left = 0.0; -- double watts_left = 0.0; -- char line[1024]; -- -- if (strlen(dirent->d_name) < 3) -- continue; -- -- sprintf(filename, "/proc/acpi/battery/%s/state", dirent->d_name); -- file = fopen(filename, "r"); -- if (!file) -- continue; -- memset(line, 0, 1024); -- while (fgets(line, 1024, file) != NULL) { -- char *c; -- if (strstr(line, "present:") && strstr(line, "no")) -- break; -- -- if (strstr(line, "charging state:") -- && !strstr(line, "discharging")) -- dontcount = 1; -- c = strchr(line, ':'); -- if (!c) -- continue; -- c++; -- -- if (strstr(line, "present voltage")) -- voltage = strtoull(c, NULL, 10) / 1000.0; -- -- if (strstr(line, "remaining capacity") && strstr(c, "mW")) -- watts_left = strtoull(c, NULL, 10) / 1000.0; -- -- if (strstr(line, "remaining capacity") && strstr(c, "mAh")) -- amperes_left = strtoull(c, NULL, 10) / 1000.0; -- -- if (strstr(line, "present rate") && strstr(c, "mW")) -- watts_drawn = strtoull(c, NULL, 10) / 1000.0 ; -- -- if (strstr(line, "present rate") && strstr(c, "mA")) -- amperes_drawn = strtoull(c, NULL, 10) / 1000.0; -- -- } -- fclose(file); -- -- if (!dontcount) { -- rate += watts_drawn + voltage * amperes_drawn; -- } -- cap += watts_left + voltage * amperes_left; -- -- -- } -- closedir(dir); -- if (prev_bat_cap - cap < 0.001 && rate < 0.001) -- last_bat_time = 0; -- if (!last_bat_time) { -- last_bat_time = prev_bat_time = time(NULL); -- last_bat_cap = prev_bat_cap = cap; -- } -- if (time(NULL) - last_bat_time >= 400) { -- prev_bat_cap = last_bat_cap; -- prev_bat_time = last_bat_time; -- last_bat_time = time(NULL); -- last_bat_cap = cap; -- } -- -- show_acpi_power_line(rate, cap, prev_bat_cap - cap, time(NULL) - prev_bat_time); -- return 1; --} -- - int print_battery_proc_pmu(void) - { - char line[80]; -@@ -719,9 +630,6 @@ - - char filename[256]; - -- if (print_battery_proc_acpi()) -- return; -- - if (print_battery_proc_pmu()) - return; - -@@ -733,7 +641,6 @@ - while ((dirent = readdir(dir))) { - int dontcount = 0; - double voltage = 0.0; -- double amperes_drawn = 0.0; - double watts_drawn = 0.0; - double watts_left = 0.0; - char line[1024]; -@@ -790,8 +697,12 @@ - watts_left *= strtoull(line, NULL, 10) / 1000000.0; - fclose(file); - -- sprintf(filename, "/sys/class/power_supply/%s/current_now", dirent->d_name); -+ sprintf(filename, "/sys/class/power_supply/%s/power_now", dirent->d_name); - file = fopen(filename, "r"); -+ if (!file) { -+ sprintf(filename, "/sys/class/power_supply/%s/current_now", dirent->d_name); -+ file = fopen(filename, "r"); -+ } - if (!file) - continue; - memset(line, 0, 1024); -@@ -801,7 +712,7 @@ - fclose(file); - - if (!dontcount) { -- rate += watts_drawn + voltage * amperes_drawn; -+ rate += watts_drawn; - } - cap += watts_left; - |