summaryrefslogtreecommitdiffstats
path: root/redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch
diff options
context:
space:
mode:
authoralbator <albator@arcadia.vtf>2011-11-19 23:17:18 +0100
committeralbator <albator@arcadia.vtf>2011-11-19 23:17:18 +0100
commitb2e59abbbae6cb8854c3d3bb8a95432d319b7ba4 (patch)
treeb449b495eee1b3f39872aff66d4f96c67d21a306 /redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch
parent334c3ce0d6df861ff1441603c6cff2f5805dd401 (diff)
downloadtde-packaging-b2e59abbbae6cb8854c3d3bb8a95432d319b7ba4.tar.gz
tde-packaging-b2e59abbbae6cb8854c3d3bb8a95432d319b7ba4.zip
RHEL/Fedora: moves ksensors to 'extras' subdir
Diffstat (limited to 'redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch')
-rw-r--r--redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch b/redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch
new file mode 100644
index 000000000..14b3cc61c
--- /dev/null
+++ b/redhat/extras/ksensors/ksensors-0.7.3-fix-min-max.patch
@@ -0,0 +1,79 @@
+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());