therm_adt746x sensor broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
torsmo (Ubuntu) |
Invalid
|
Medium
|
MOTU Reviewers Team |
Bug Description
Torsmo is unable to monitor cpu temperature and fan speed on my iBook G4. This is due to two different problems:
1) the $adt746xcpu and $adt746xfan keyword are not parsed, although it exists some code to handle them.
2) after kernel 2.6.12 the therm_adt746x modules changed the name of some files in /sys/devices/
Another (minor) issue is that torsmo could not monitor the GPU sensor temperature (namely /sys/devices/
I wrote a small patch that solves the first two issues and add support for the GPU sensor with the $adt746xgpu keyword: it seems to work well, so I decided to post it in this report. It is diffed against the full debian source of torsmo 0.18-5.
Here it is:
-------
diff -ur torsmo-0.18/linux.c torsmo-
--- torsmo-0.18/linux.c 2004-12-21 22:20:07.000000000 +0100
+++ torsmo-
@@ -377,7 +377,7 @@
return val;
}
-#define ADT746X_FAN "/sys/devices/
+#define ADT746X_FAN "/sys/devices/
static char *adt746x_fan_state;
@@ -401,7 +401,7 @@
return adt746x_fan_state;
}
-#define ADT746X_CPU "/sys/devices/
+#define ADT746X_CPU "/sys/devices/
static char *adt746x_cpu_state;
@@ -415,12 +415,40 @@
}
fp = open_file(
- fscanf(fp, "%2s", adt746x_cpu_state);
- fclose(fp);
+ if (fp != NULL) {
+ fscanf(fp, "%2s", adt746x_cpu_state);
+ fclose(fp);
+ }
+ else
+ strcpy(
return adt746x_cpu_state;
}
+#define ADT746X_GPU "/sys/devices/
+
+static char *adt746x_gpu_state;
+
+char* get_adt746x_gpu() {
+ static int rep;
+ FILE *fp;
+
+ if (adt746x_gpu_state == NULL) {
+ adt746x_gpu_state = (char*)malloc(100);
+ assert(
+ }
+
+ fp = open_file(
+ if (fp != NULL) {
+ fscanf(fp, "%2s", adt746x_gpu_state);
+ fclose(fp);
+ }
+ else
+ strcpy(
+
+ return adt746x_gpu_state;
+}
+
static char *frequency;
char* get_freq()
diff -ur torsmo-
--- torsmo-
+++ torsmo-
@@ -283,6 +283,7 @@
OBJ_
OBJ_adt746xcpu,
OBJ_adt746xfan,
+ OBJ_adt746xgpu,
OBJ_acpifan,
OBJ_acpitemp,
OBJ_battery,
@@ -477,6 +478,12 @@
END
OBJ(
END
+ OBJ(adt746xcpu, 0)
+ END
+ OBJ(adt746xfan, 0)
+ END
+ OBJ(adt746xgpu, 0)
+ END
OBJ(freq, 0)
END
OBJ(acpifan, 0)
@@ -894,6 +901,9 @@
OBJ(
snprintf(p, n, "%s", get_adt746x_fan());
}
+ OBJ(adt746xgpu) {
+ snprintf(p, n, "%s", get_adt746x_gpu());
+ }
OBJ(acpifan) {
snprintf(p, n, "%s", get_acpi_fan());
}
diff -ur torsmo-
--- torsmo-
+++ torsmo-
@@ -177,6 +177,7 @@
char* get_adt746x_
char* get_adt746x_
+char* get_adt746x_
int open_acpi_
double get_acpi_
-------
Changed in torsmo: | |
assignee: | nobody → motu |
Changed in torsmo: | |
assignee: | motu → motureviewers |
Ops. Including the patch inline in the report was not a good idea. Sorry.