Commit 947a67ea243d02d7c53d60d546b8799eecd27621

Con Kolivas 2012-10-07T12:52:48

Cope with broken drivers returning nonsense values for bitforce temperatures.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/driver-bitforce.c b/driver-bitforce.c
index ded9e92..189daa6 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -410,6 +410,11 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
 	if ((!strncasecmp(pdevbuf, "TEMP", 4)) && (s = strchr(pdevbuf + 4, ':'))) {
 		float temp = strtof(s + 1, NULL);
 
+		/* Cope with older software  that breaks and reads nonsense
+		 * values */
+		if (temp > 100)
+			temp = strtol(s + 1, NULL, 10);
+
 		if (temp > 0) {
 			bitforce->temp = temp;
 			if (unlikely(bitforce->cutofftemp > 0 && temp > bitforce->cutofftemp)) {