rpms/ksensors/F-7 ksensors-0.7.3-fix-min-max.patch, NONE, 1.1 ksensors.spec, 1.16, 1.17

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Sun Nov 11 14:32:06 UTC 2007


Author: jwrdegoede

Update of /cvs/extras/rpms/ksensors/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27748

Modified Files:
	ksensors.spec 
Added Files:
	ksensors-0.7.3-fix-min-max.patch 
Log Message:
* Sun Nov 11 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.7.3-13
- Fix reading of min and max tresholds from libsensors


ksensors-0.7.3-fix-min-max.patch:

--- NEW FILE ksensors-0.7.3-fix-min-max.patch ---
diff -up ksensors-0.7.3/src/lmsensor.cpp.minmax ksensors-0.7.3/src/lmsensor.cpp
--- ksensors-0.7.3/src/lmsensor.cpp.minmax	2007-11-11 15:12:24.000000000 +0100
+++ ksensors-0.7.3/src/lmsensor.cpp	2007-11-11 15:26:30.000000000 +0100
@@ -40,17 +40,30 @@ bool LMSensor::init(const sensors_featur
  char *label;
  QString str;
 
- bool min_max=false;
+ bool min_found=false;
+ bool max_found=false;
  while( (*data= sensors_get_all_features(*chip_name, nr1, nr2)) && (*data)->mapping!=SENSORS_NO_MAPPING) {
-   str= (*data)->name;
-   if(str.find("_min")>=0 || str.find("_low")>=0) {
-     sensors_get_feature(*chip_name, (*data)->number, &valMin);
-     min_max=true;
-   } 
-   else if(str.find("_max")>=0 || str.find("_over")>=0  || str.find("_high")>=0) {
-     sensors_get_feature(*chip_name, (*data)->number, &valMax);
-     min_max=true;
+   int len = strlen((*data)->name);
+   const char *postfix = (*data)->name + len - 4;
+
+   if (len < 5)
+     continue;
+
+   if((!strcmp(postfix, "_min") || !strcmp(postfix, "_low")) &&
+      !sensors_get_feature(*chip_name, (*data)->number, &valMin))
+     min_found=true;
+   
+   if(!strcmp(postfix, "_max") &&
+      !sensors_get_feature(*chip_name, (*data)->number, &valMax)) {
+     max_found=true;
+     continue;
    }
+
+   postfix--;
+
+   if((!strcmp(postfix, "_over") || !strcmp(postfix, "_high")) &&
+      !sensors_get_feature(*chip_name, (*data)->number, &valMax))
+     max_found=true;
  }
 
  double newVal;
@@ -87,22 +100,21 @@ bool LMSensor::init(const sensors_featur
  sensors_get_label(*chip_name,feature,&label);
  setDescription(QString(label));
 
- if(min_max){
-   if(min>max) {
-     double pivot= valMin;
-     min= max;
-     max= pivot;
-   }
-   setValueMax(max,dgCelsius);
-   setValueMin(min,dgCelsius);
-   setValue((max+min)/2,dgCelsius);
- }
- else {
-   setValueMax(70,dgCelsius);
-   setValueMin(0,dgCelsius);
-   setValue(newVal,dgCelsius);
+ if(min_found)
+   min = valMin;
+   
+ if(max_found)
+   max = valMax;
+   
+ if(min>max) {
+   double pivot= min;
+   min= max;
+   max= pivot;
  }
 
+ setValueMax(max,dgCelsius);
+ setValueMin(min,dgCelsius);
+
  readConfig();
  updateValue();
  setValueIdeal(getValue());


Index: ksensors.spec
===================================================================
RCS file: /cvs/extras/rpms/ksensors/F-7/ksensors.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ksensors.spec	27 Jul 2007 22:42:58 -0000	1.16
+++ ksensors.spec	11 Nov 2007 14:31:31 -0000	1.17
@@ -1,24 +1,20 @@
 Name:           ksensors
 Version:        0.7.3
-Release:        11%{?dist}
+Release:        13%{?dist}
 Summary:        KDE frontend to lm_sensors
-
 Group:          Applications/System
-License:        GPL
+License:        GPLv2+
 URL:            http://ksensors.sourceforge.net/
 Source0:        http://downloads.sourceforge.net/ksensors/%{name}-%{version}.tar.gz
 Patch1:         %{name}-desktop.patch
 Patch2:         http://ftp.debian.org/debian/pool/main/k/ksensors/ksensors_0.7.3-14.diff.gz
 Patch3:         %{name}-0.7.3-po.patch
+Patch4:         %{name}-0.7.3-fix-min-max.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
+BuildRequires:  kdelibs-devel lm_sensors-devel gettext desktop-file-utils
+Requires:       hicolor-icon-theme
 # Keep archs in sync with lm_sensors
 ExcludeArch:    s390 s390x
-BuildRequires:  kdelibs-devel
-BuildRequires:  lm_sensors-devel
-BuildRequires:  gettext
-BuildRequires:  desktop-file-utils
-Requires:       hicolor-icon-theme
 
 %description
 KSensors is a nice lm-sensors frontend for the K Desktop Environment.
@@ -31,6 +27,7 @@
 %patch1 -p1 -z .desktop
 %patch2 -p1
 %patch3 -p1 -z .po
+%patch4 -p1 -z .minmax
 sed -i -e 's|$(kde_datadir)/sounds|$(kde_sounddir)|' src/sounds/Makefile.*
 for f in ChangeLog LIESMICH LISEZMOI ; do
     iconv -f iso-8859-1 -t utf-8 $f > $f.utf8 ; mv $f.utf8 $f
@@ -89,6 +86,12 @@
 
 
 %changelog
+* Sun Nov 11 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.7.3-13
+- Fix reading of min and max tresholds from libsensors
+
+* Mon Aug 13 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.7.3-12
+- Update License tag for new Licensing Guidelines compliance
+
 * Fri Jul 27 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.7.3-11
 - Remove OnlyShowIn=KDE; from .desktop file (I like using ksensors under GNOME,
   works fine grumbel) 




More information about the fedora-extras-commits mailing list