From 042fbe64d977d90d356070cc2720743619c91c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Tue, 17 Apr 2012 16:06:29 +0200 Subject: [PATCH] Show power consumption only if discharging Resolves: rhbz#811949 --- powertop-1.98-show-watts-only-if-discharging.patch | 12 ++++++++++++ powertop.spec | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 powertop-1.98-show-watts-only-if-discharging.patch diff --git a/powertop-1.98-show-watts-only-if-discharging.patch b/powertop-1.98-show-watts-only-if-discharging.patch new file mode 100644 index 0000000..54d7b7d --- /dev/null +++ b/powertop-1.98-show-watts-only-if-discharging.patch @@ -0,0 +1,12 @@ +diff -up powertop-1.98/measurement/measurement.cpp.orig powertop-1.98/measurement/measurement.cpp +--- powertop-1.98/measurement/measurement.cpp.orig 2012-04-17 15:47:59.000000000 +0200 ++++ powertop-1.98/measurement/measurement.cpp 2012-04-17 15:49:31.690862740 +0200 +@@ -130,7 +130,7 @@ void power_supply_callback(const char *d + while (file) { + file.getline(line, 4096); + +- if (strstr(line, "POWER_SUPPLY_STATUS") && strstr(line, "POWER_SUPPLY_STATUS")) ++ if (strstr(line, "POWER_SUPPLY_STATUS") && strstr(line, "Discharging")) + discharging = true; + } + file.close(); diff --git a/powertop.spec b/powertop.spec index 618d728..458a7b6 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,6 +1,6 @@ Name: powertop Version: 1.98 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Power consumption monitor Group: Applications/System @@ -23,6 +23,7 @@ Patch5: powertop-1.98-power-supply-units-fix.patch # Accepted upstream Patch6: powertop-1.98-html-print-commands.patch Patch7: powertop-1.98-html-escape.patch +Patch8: powertop-1.98-show-watts-only-if-discharging.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl-devel @@ -40,6 +41,7 @@ computer use more power than necessary while it is idle. %patch5 -p1 -b .power-supply-units-fix %patch6 -p1 -b .html-print-commands %patch7 -p1 -b .html-escape +%patch8 -p1 -b .show-watts-only-if-discharging %build make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" @@ -72,6 +74,10 @@ rm -rf %{buildroot} #%{_mandir}/man8/powertop.8* %changelog +* Tue Apr 17 2012 Jaroslav Škarvada - 1.98-9 +- Show power consumption only if discharging + Resolves: rhbz#811949 + * Tue Apr 03 2012 Jan Kaluza - 1.98-8 - Escape scripts in HTML output