rpms/ksensors/F-8 ksensors-0.7.3-fix-min-max.patch, NONE, 1.1 ksensors.spec, 1.19, 1.20

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


Author: jwrdegoede

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

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-8/ksensors.spec,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ksensors.spec	13 Aug 2007 15:17:33 -0000	1.19
+++ ksensors.spec	11 Nov 2007 14:31:09 -0000	1.20
@@ -1,6 +1,6 @@
 Name:           ksensors
 Version:        0.7.3
-Release:        12%{?dist}
+Release:        13%{?dist}
 Summary:        KDE frontend to lm_sensors
 Group:          Applications/System
 License:        GPLv2+
@@ -9,6 +9,7 @@
 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
@@ -26,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
@@ -84,6 +86,9 @@
 
 
 %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
 




More information about the fedora-extras-commits mailing list