Initial import (rhbz#1440406)

This commit is contained in:
Björn Esser 2017-04-11 18:32:34 +02:00
parent edf37bc157
commit ba8198826c
8 changed files with 39742 additions and 0 deletions

4
.gitignore vendored
View File

@ -0,0 +1,4 @@
*~
*.rpm
*.tar*
results_*/

View File

@ -0,0 +1 @@
SHA512 (thermald-1.6.tar.gz) = ddcd01dcd2f6b5666ffa16ba635734e4c146244b5df7c3f0deb8120f8ee7ebf1f4ee302d49db2b7e9a4950045650922977bd40bf6b38ccea9896f81e06df1d49

View File

@ -0,0 +1,30 @@
From 6a2344b4a55acc0cba356d0f7c521c0cdb6632e0 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Mon, 13 Mar 2017 16:40:42 +0000
Subject: [PATCH] Fix build warning on i386 architecture builds
print out size as size_t type, use %zu format specifier to
fix build warning on 32 bit i386:
/usr/include/glib-2.0/glib/gmessages.h:342:43: warning: format '%lu'
expects argument of type 'long unsigned int', but argument 4 has
type 'std::vector<zone_trip_limits_t>::size_type {aka unsigned int}'
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
src/thd_cdev.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/thd_cdev.cpp b/src/thd_cdev.cpp
index 6ee09ee..4850860 100644
--- a/src/thd_cdev.cpp
+++ b/src/thd_cdev.cpp
@@ -199,7 +199,7 @@ int cthd_cdev::thd_cdev_set_state(int set_point, int target_temp,
}
}
} else {
- thd_log_debug("zone_trip_limits.size() %lu\n", zone_trip_limits.size());
+ thd_log_debug("zone_trip_limits.size() %zu\n", (size_t)zone_trip_limits.size());
if (zone_trip_limits.size() > 0) {
int length = zone_trip_limits.size();
int _target_value = TRIP_PT_INVALID_TARGET_STATE;

View File

@ -0,0 +1,35 @@
From 98d1201a0931f5ba3f9cf672b1137bfef17e4085 Mon Sep 17 00:00:00 2001
From: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
Date: Thu, 25 Dec 2014 20:28:49 +0100
Subject: [PATCH] Load the preference value provided by the xml file The
preference value was just parsed by phd_parser.cpp but not forwarded to the
engine. Check if the platform matched the id given by the xml file before
apllying the preference value
---
src/thd_engine.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/thd_engine.cpp b/src/thd_engine.cpp
index e4a4ef1..8927f79 100644
--- a/src/thd_engine.cpp
+++ b/src/thd_engine.cpp
@@ -235,6 +235,10 @@ int cthd_engine::thd_engine_start(bool ignore_cpuid_check) {
return THD_FATAL_ERROR;
}
+ if (parser.platform_matched()) {
+ parser.set_default_preference();
+ }
+
// Check if polling is disabled and sensors don't support
// async mode, in that enable force polling
if (!poll_interval_sec) {
@@ -299,6 +303,7 @@ int cthd_engine::thd_engine_start(bool ignore_cpuid_check) {
}
}
#endif
+ thd_pref.refresh();
preference = thd_pref.get_preference();
thd_log_info("Current user preference is %d\n", preference);

View File

@ -0,0 +1,24 @@
From 37a25879239466f2d096fd1a58b2ac7bbc3958f5 Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: Mon, 27 Mar 2017 17:39:30 -0700
Subject: [PATCH] set default preference
In case there is missing element for preference, set ENERGY_CONSERVE
as default.
---
src/thd_parse.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/thd_parse.cpp b/src/thd_parse.cpp
index f73d43e..f5e0870 100644
--- a/src/thd_parse.cpp
+++ b/src/thd_parse.cpp
@@ -462,6 +462,8 @@ int cthd_parse::parse_new_platform_info(xmlNode * a_node, xmlDoc *doc,
xmlNode *cur_node = NULL;
char *tmp_value;
+ info_ptr->default_prefernce = PREF_ENERGY_CONSERVE;
+
for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
if (cur_node->type == XML_ELEMENT_NODE) {
DEBUG_PARSER_PRINT("node type: Element, name: %s value: %s\n", cur_node->name, xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1));

View File

@ -0,0 +1,28 @@
From a8eba71a95b3b8af0540f6a93877e24bc8c47079 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Tue, 7 Mar 2017 11:47:51 +0000
Subject: [PATCH] thd_cdev: ensure _target_value is initialized
This fixes an issue discovered by static analysis with
CoverityScan.
CoverityScan CID#157084 ("Uninitialized scalar value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
src/thd_cdev.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/thd_cdev.cpp b/src/thd_cdev.cpp
index 107c1d5..6ee09ee 100644
--- a/src/thd_cdev.cpp
+++ b/src/thd_cdev.cpp
@@ -202,7 +202,7 @@ int cthd_cdev::thd_cdev_set_state(int set_point, int target_temp,
thd_log_debug("zone_trip_limits.size() %lu\n", zone_trip_limits.size());
if (zone_trip_limits.size() > 0) {
int length = zone_trip_limits.size();
- int _target_value;
+ int _target_value = TRIP_PT_INVALID_TARGET_STATE;
int i;
// Just remove the current zone requesting to turn off

File diff suppressed because it is too large Load Diff

276
thermald.spec Normal file
View File

@ -0,0 +1,276 @@
%global pkgname thermal_daemon
Name: thermald
Version: 1.6
Release: 1%{?dist}
Summary: Thermal Management daemon
License: GPLv2+
URL: https://github.com/01org/%{pkgname}
Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Fixes from upstream.
Patch0: %{url}/commit/a8eba71a95b3b8af0540f6a93877e24bc8c47079.patch#/%{name}-1.6-thd_cdev_target_value_initialized.patch
Patch1: %{url}/commit/6a2344b4a55acc0cba356d0f7c521c0cdb6632e0.patch#/%{name}-1.6-fix_build_warnings_on_32bits.patch
Patch2: %{url}/commit/2a00d1745161c6d11b927f025ff1f4bb44f61d15.patch#/%{name}-1.6-load_preference_from_xml_file.patch
Patch3: %{url}/commit/37a25879239466f2d096fd1a58b2ac7bbc3958f5.patch#/%{name}-1.6-set_default_preference.patch
Patch4: %{url}/commit/35bda2d052b8820cbfce6c1918e3866c6fa3fd76.patch#/%{name}-1.6-update_QCustomPlot_2_0_0_beta.patch
# No cpuid.h on other arches.
ExclusiveArch: %{ix86} x86_64
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: dbus-glib-devel
BuildRequires: desktop-file-utils
BuildRequires: gcc-c++
BuildRequires: glib-devel
BuildRequires: libxml2-devel
BuildRequires: systemd
Requires: dbus%{?_isa}
Requires(pre): glibc-common
Requires(pre): shadow-utils
%{?systemd_requires}
%description
%{name} monitors and controls platform temperature.
Thermal issues are important to handle proactively to reduce performance
impact. %{name} uses the existing Linux kernel infrastructure and can
be easily enhanced.
%package monitor
Summary: Application for monitoring %{name}
License: GPLv3+
BuildRequires: qt5-qtbase-devel
Requires: hicolor-icon-theme
Requires: %{name}%{?_isa} == %{version}-%{release}
%description monitor
This package contains an Application to monitor %{name} for system
developers who want to enable application developers and their
customers with the responsive and flexible thermal management,
supporting optimal performance in desktop, clam-shell, mobile and
embedded devices.
%prep
%autosetup -n %{pkgname}-%{version} -p 1
# Create tmpfiles.d config.
%{__mkdir} -p fedora_addons
%{__cat} << EOF > fedora_addons/%{name}.conf
d %{_rundir}/%{name} 0755 root root -
EOF
# Create desktop-file for the monitor-app.
%{__cat} << EOF > fedora_addons/%{name}-monitor.desktop
[Desktop Entry]
Name=%{name} Monitor
Comment=Application for monitoring %{name}
Icon=%{name}-monitor
Categories=System;Settings
Exec=%{_bindir}/ThermalMonitor
Type=Application
StartupNotify=true
Terminal=false
EOF
# Create icon for the monitor-app.
%{__cat} << EOF > fedora_addons/%{name}-monitor.svg
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#EFEFEF;" d="M501.106,256c0,33.661-6.787,65.732-19.064,94.927L256,239.66L29.957,350.927
C17.68,321.732,10.894,289.661,10.894,256C10.894,120.636,120.636,10.894,256,10.894S501.106,120.636,501.106,256z"/>
<path style="fill:#F15A29;" d="M430.294,256c0,22.43-4.238,43.869-11.961,63.564l-96.202-47.355c1.264-5.196,1.95-10.621,1.95-16.21
c0-18.802-7.626-35.818-19.935-48.15l75.101-75.101C410.783,164.298,430.294,207.872,430.294,256z"/>
<path style="fill:#FBA026;" d="M418.332,319.564c-25.393,64.828-88.5,110.734-162.337,110.734
c-73.826,0-136.933-45.895-162.337-110.723C85.935,299.879,81.698,278.43,81.698,256c0-96.256,78.042-174.298,174.298-174.298
c48.128,0,91.702,19.51,123.25,51.047l-75.101,75.101c12.31,12.332,19.935,29.347,19.935,48.15c0,5.588-0.686,11.013-1.95,16.21
L418.332,319.564z"/>
<path style="fill:#27AAE1;" d="M482.038,350.927c-37.093,88.227-124.34,150.179-226.043,150.179S67.046,439.154,29.953,350.927
l63.706-31.352l96.212-47.365c-1.264-5.196-1.961-10.621-1.961-16.21c0-37.605,30.491-68.085,68.085-68.085
c18.802,0,35.818,7.626,48.15,19.935c12.31,12.332,19.935,29.347,19.935,48.15c0,5.588-0.686,11.013-1.95,16.21l96.202,47.355
L482.038,350.927z"/>
<circle style="fill:#EFEFEF;" cx="256" cy="256" r="21.787"/>
<g>
<path style="fill:#231F20;" d="M191.566,307.802l-77.373,38.086c-5.398,2.657-7.62,9.187-4.963,14.584
c1.895,3.851,5.762,6.085,9.781,6.085c1.614,0,3.255-0.362,4.802-1.122l77.373-38.087c5.398-2.657,7.62-9.187,4.963-14.584
C203.495,307.369,196.965,305.147,191.566,307.802z"/>
<path style="fill:#231F20;" d="M245.106,457.532c0,6.017,4.878,10.894,10.894,10.894c28.936,0,57.027-5.721,83.495-17.005
c26.031-11.098,49.226-27.021,68.936-47.325c4.192-4.316,4.088-11.213-0.228-15.405c-4.317-4.19-11.213-4.087-15.405,0.229
c-36.133,37.22-84.715,57.719-136.799,57.719C249.985,446.638,245.106,451.515,245.106,457.532z"/>
<path style="fill:#231F20;" d="M415.931,379.26c1.884,1.293,4.028,1.912,6.153,1.912c3.47,0,6.88-1.655,8.993-4.731l0.15-0.219
c3.403-4.961,2.142-11.742-2.82-15.145c-4.958-3.403-11.74-2.142-15.145,2.819l-0.15,0.219
C409.708,369.076,410.969,375.856,415.931,379.26z"/>
<path style="fill:#231F20;" d="M288.681,256.002c0-18.02-14.661-32.681-32.681-32.681s-32.681,14.661-32.681,32.681
S237.98,288.683,256,288.683S288.681,274.022,288.681,256.002z M245.106,256.002c0-6.007,4.887-10.894,10.894-10.894
c6.007,0,10.894,4.887,10.894,10.894c0,6.007-4.887,10.894-10.894,10.894C249.993,266.896,245.106,262.009,245.106,256.002z"/>
<path style="fill:#231F20;" d="M512,256c0-68.378-26.628-132.665-74.982-181.017S324.379,0,256,0
C187.622,0,123.335,26.629,74.982,74.983C26.629,123.335,0,187.622,0,256c0,34.321,6.685,67.638,19.868,99.032
c0.015,0.039,0.026,0.078,0.042,0.118C59.97,450.433,152.639,512,255.996,512s196.025-61.567,236.085-156.851
c0,0,0-0.001,0.001-0.002l0.002,0.003C505.299,323.726,512,290.367,512,256z M255.996,490.213
c-91.135,0-173.186-52.313-211.823-134.142l150.511-74.087c4.58-2.255,6.98-7.387,5.774-12.348
c-1.097-4.507-1.653-9.095-1.653-13.636c0-31.536,25.657-57.191,57.191-57.191c15.265,0,29.632,5.949,40.44,16.738
c10.802,10.822,16.751,25.188,16.751,40.453c0,4.57-0.552,9.157-1.642,13.636c-1.206,4.961,1.194,10.094,5.775,12.348
l150.499,74.086C429.182,437.898,347.131,490.213,255.996,490.213z M92.591,256c0-90.101,73.303-163.404,163.404-163.404
c39.988,0,77.792,14.274,107.592,40.406l-59.981,59.984c-13.652-10.349-30.203-15.964-47.611-15.964
c-43.549,0-78.979,35.429-78.979,78.979c0,3.354,0.218,6.721,0.651,10.076l-77.795,38.292
C95.042,288.781,92.591,272.563,92.591,256z M378.993,148.407C405.126,178.206,419.4,216.011,419.4,256
c0,16.559-2.443,32.779-7.276,48.367l0.001,0.002l-77.797-38.297c0.43-3.344,0.646-6.712,0.646-10.072
c0-17.413-5.618-33.97-15.981-47.631l0.031,0.01L378.993,148.407z M431.875,314.091c6.176-18.676,9.312-38.169,9.312-58.091
c0-45.811-16.535-89.081-46.766-123.018l5.449-5.448c4.254-4.254,4.254-11.152,0-15.406c-4.253-4.254-11.149-4.254-15.407,0
l-5.449,5.449c-33.938-30.232-77.207-46.768-123.018-46.768C153.881,70.809,70.804,153.885,70.804,256
c0,19.926,3.134,39.421,9.309,58.095L35.774,335.92c-9.286-25.546-13.986-52.377-13.986-79.92
C21.787,126.855,126.854,21.787,256,21.787S490.213,126.855,490.213,256c0,27.547-4.701,54.378-13.987,79.922l0.002,0.003
L431.875,314.091z"/>
</g>
</svg>
EOF
# Create ReadMe.txt for the monitor-app.
%{__cat} << EOF > fedora_addons/%{name}-monitor.ReadMe.txt
Running the thermald-monitor-app
--------------------------------
To communicate with thermald via dbus, the user has to be member
of the "power" group. So make sure to add your user id to this
group before using the thermald-monitor-app.
EOF
%{_bindir}/autoreconf -fiv
%build
%configure \
--disable-option-checking \
--disable-silent-rules
%make_build
# Build the monitor-app.
pushd tools/thermal_monitor
%{__mkdir} -p %{_target_platform}
pushd %{_target_platform}
%{qmake_qt5} ..
%make_build
popd
popd
%install
%make_install
# Install management-script.
%{__install} -Dpm 0755 tools/thermald_set_pref.sh \
%{buildroot}%{_bindir}/%{name}-set-pref
# DBus config belongs into %%{_datadir}.
%{__mkdir} -p %{buildroot}%{_datadir}
%{__mv} -f %{buildroot}%{_sysconfdir}/dbus-1/* %{buildroot}%{_datadir}/dbus-1/
# No Upstart.
%{__rm} -fr %{buildroot}%{_sysconfdir}/init
# Setup tmpfiles.d
%{__install} -Dpm 0644 fedora_addons/%{name}.conf \
%{buildroot}%{_tmpfilesdir}/%{name}.conf
%{__install} -dm 0755 %{buildroot}%{_rundir}/%{name}
/bin/echo "%{name}_pid" > %{buildroot}%{_rundir}/%{name}/%{name}.pid
%{__chmod} -c 0644 %{buildroot}%{_rundir}/%{name}/%{name}.pid
# Install the monitor-app.
%{__install} -Dpm 0755 tools/thermal_monitor/%{_target_platform}/ThermalMonitor \
%{buildroot}%{_bindir}/ThermalMonitor
%{__install} -Dpm 0644 fedora_addons/%{name}-monitor.desktop \
%{buildroot}%{_datadir}/applications/%{name}-monitor.desktop
%{__install} -Dpm 0644 fedora_addons/%{name}-monitor.svg \
%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}-monitor.svg
%check
%{_bindir}/desktop-file-validate \
%{buildroot}%{_datadir}/applications/*.desktop
%pre
/bin/getent group power >/dev/null || /sbin/groupadd -r power
exit 0
%post
%systemd_post thermald.service
%preun
%systemd_preun thermald.service
%postun
%systemd_postun_with_restart thermald.service
%post monitor
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun monitor
if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
%{_bindir}/gtk-update-icon-cache %{_datadir}/icons/hicolor \
&>/dev/null || :
fi
%posttrans monitor
%{_bindir}/gtk-update-icon-cache %{_datadir}/icons/hicolor \
&>/dev/null || :
%files
%config(noreplace) %{_sysconfdir}/%{name}
%doc README.txt thermal_daemon_usage.txt
%ghost %dir %{_rundir}/%{name}
%ghost %{_rundir}/%{name}/%{name}.pid
%license COPYING
%{_bindir}/%{name}-set-pref
%{_datadir}/dbus-1/system-services/org.freedesktop.%{name}.service
%{_datadir}/dbus-1/system.d/org.freedesktop.%{name}.conf
%{_mandir}/man5/thermal-conf.xml.5*
%{_mandir}/man8/%{name}.8*
%{_sbindir}/%{name}
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/%{name}.service
%files monitor
%doc fedora_addons/%{name}-monitor.ReadMe.txt
%license tools/thermal_monitor/qcustomplot/GPL.txt
%{_bindir}/ThermalMonitor
%{_datadir}/applications/%{name}-monitor.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}-monitor.svg
%changelog
* Tue Apr 11 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-1
- Initial import (rhbz#1440406)
* Mon Apr 10 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.4
- Use qmake_qt5-macro and build out of tree
* Sat Apr 08 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.3
- Small packaging improvements
* Sat Apr 08 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.2
- Add management-script
* Sat Apr 08 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.1
- Initial rpm-release (rhbz#1440406)