--- bbc_envctrl_old.c 2010-01-08 13:37:38.000000000 +0100 +++ bbc_envctrl.c 2010-01-08 13:38:32.000000000 +0100 @@ -10,6 +10,7 @@ #include #include #include +#include #include "bbc_i2c.h" #include "max1617.h" @@ -564,9 +564,26 @@ set_fan_speeds(fp); } +int proc_read(char *buf, char **start, off_t offset, + int count, int *eof, void *data) +{ + struct bbc_fan_control *fp = all_bbc_fans; + struct bbc_cpu_temperature *tp = all_bbc_temps; + sprintf(buf, "Current system fan RPM: %i00\nCurrent CPU fan RPM: %i00", + fp->system_fan_speed, fp->cpu_fan_speed); + char *tempbuf = buf; + int len = sprintf(buf, "%s\nCurrent CPU0 temperature: %i °C\nCurrent ambient temperature: %i °C\n", + tempbuf, (int) tp->curr_cpu_temp, (int) tp->curr_amb_temp); + return len; +} int bbc_envctrl_init(void) { + create_proc_read_entry( "bbc", // filename + 0, // protection mode: default + NULL, // parent dir: none + proc_read, // callback + NULL); struct linux_ebus_child *echild; int temp_index = 0; int fan_index = 0; @@ -601,6 +618,8 @@ void bbc_envctrl_cleanup(void) { + remove_proc_entry("bbc", // filename + NULL); // parent directory struct bbc_cpu_temperature *tp; struct bbc_fan_control *fp;