add support for applesmc sensors
PATCH 1/1 add support for applesmc sensors
Dear list,
this adds support for the sensors found on macbook/pro's etc. It requires applesmc to be loaded and on my mbp c1d I get an amazing 14 (!) sensors (12 temperature, 2 fans in addition to the 2 coretemps).
Please apply!
Soeren
Signature · 2 lines
For the one fact about the future of which we can be certain is that it will be utterly fantastic. -- Arthur C. Clarke, 1962
home/sonne/lm-sensors-2.10.3/lib/chips.c renamed from lib/chips.c +46 -0
@@ -5965,6 +5965,51 @@ { { 0 }, 0 } }; +static sensors_chip_feature applesmc_features[] = + { + { {SENSORS_APPLESMC_TEMP (0 ),"temp1" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (1 ),"temp2" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (2 ),"temp3" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (3 ),"temp4" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (4 ),"temp5" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (5 ),"temp6" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (6 ),"temp7" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (7 ),"temp8" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (8 ),"temp9" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (9 ),"temp10" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (10 ),"temp11" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_TEMP (11 ),"temp12" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),3 }, + { {SENSORS_APPLESMC_FAN (0 ),"fan1" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN (1 ),"fan2" ,NOMAP ,NOMAP ,R }, +NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN_MIN (0 ),"fan1_min" ,SENSORS_APPLESMC_FAN (0 ), +SENSORS_APPLESMC_FAN (0 ),R },NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN_MIN (1 ),"fan2_min" ,SENSORS_APPLESMC_FAN (1 ), +SENSORS_APPLESMC_FAN (1 ),R },NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN_MAX (0 ),"fan1_max" ,SENSORS_APPLESMC_FAN (0 ), +SENSORS_APPLESMC_FAN (0 ),R },NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN_MAX (1 ),"fan2_max" ,SENSORS_APPLESMC_FAN (1 ), +SENSORS_APPLESMC_FAN (1 ),R },NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN_SAFE (0 ),"fan1_safe" ,SENSORS_APPLESMC_FAN (0 ), +SENSORS_APPLESMC_FAN (0 ),R },NOSYSCTL ,VALUE (2 ),0 }, + { {SENSORS_APPLESMC_FAN_SAFE (1 ),"fan2_safe" ,SENSORS_APPLESMC_FAN (1 ), +SENSORS_APPLESMC_FAN (1 ),R },NOSYSCTL ,VALUE (2 ),0 }, + { {0 },0 } + }; +sensors_chip_features sensors_chip_features_list[] = { {SENSORS_LM78_PREFIX , lm78_features },
@@ -6077,5 +6122,6 @@ { SENSORS_ABITUGURU_PREFIX, abituguru_features }, { SENSORS_K8TEMP_PREFIX, k8temp_features }, { SENSORS_CORETEMP_PREFIX, coretemp_features }, + { SENSORS_APPLESMC_PREFIX, applesmc_features }, { 0 } };
home/sonne/lm-sensors-2.10.3/lib/chips.h renamed from lib/chips.h +12 -0
@@ -2262,4 +2262,16 @@#define SENSORS_CORETEMP_TEMP1_CRIT 0x02/* R */ #define SENSORS_CORETEMP_TEMP1_CRIT_ALARM 0x03/* R */ +/* applesmc */ +#define SENSORS_APPLESMC_PREFIX "applesmc" + +/* temp n from 0 to 11 */ +#define SENSORS_APPLESMC_TEMP (n) ( 0x01 + (n))/* R */ + +/* fan n from 0 to 1 */ +#define SENSORS_APPLESMC_FAN (n) ( 0x21 + (n))/* R */ +#define SENSORS_APPLESMC_FAN_MIN (n) ( 0x41 + (n))/* R */ +#define SENSORS_APPLESMC_FAN_MAX (n) ( 0x61 + (n))/* R */ +#define SENSORS_APPLESMC_FAN_SAFE (n) ( 0x81 + (n))/* R */ +#endif /* def LIB_SENSORS_CHIPS_H */
home/sonne/lm-sensors-2.10.3/prog/sensors/chips.c renamed from prog/sensors/chips.c +35 -0
@@ -6337,6 +6337,41 @@free (label); } +void print_applesmc (const sensors_chip_name *name) +{ +char *label; +double cur, min, max, safe; +int valid; +int i; + +for (i=0 ; i<12 ; i++) { +if (!sensors_get_label_and_valid (*name,SENSORS_APPLESMC_TEMP (i), &label, &valid) + && !sensors_get_feature (*name,SENSORS_APPLESMC_TEMP (i), &cur)) { +if (valid) { +print_label (label,10 ); +print_temp_info (cur,0 ,0 ,SINGLE ,0 ,0 ); +printf ("\n" ); + } + } +free (label); + } + +for (i=0 ; i<2 ; i++) { +if (!sensors_get_label_and_valid (*name,SENSORS_APPLESMC_FAN (i), &label, &valid) + && !sensors_get_feature (*name,SENSORS_APPLESMC_FAN (i), &cur) + && !sensors_get_feature (*name,SENSORS_APPLESMC_FAN_MIN (i), &min) + && !sensors_get_feature (*name,SENSORS_APPLESMC_FAN_MAX (i), &max) + && !sensors_get_feature (*name,SENSORS_APPLESMC_FAN_SAFE (i), &safe)){ +if (valid) { +print_label (label,10 ); +printf ("%4.0f RPM (safe = %4.0f RPM, min = %4.0f RPM, max = %4.0f RPM)\n" , cur, + safe, min, max); + } + } +free (label); + } +} +void print_unknown_chip (const sensors_chip_name *name) {int a,b,valid;
home/sonne/lm-sensors-2.10.3/prog/sensors/chips.h renamed from prog/sensors/chips.h +1 -0
@@ -78,5 +78,6 @@extern void print_abituguru (const sensors_chip_name *name);extern void print_k8temp (const sensors_chip_name *name);extern void print_coretemp (const sensors_chip_name *name); +extern void print_applesmc (const sensors_chip_name *name);#endif /* def PROG_SENSORS_CHIPS_H */
home/sonne/lm-sensors-2.10.3/prog/sensors/main.c renamed from prog/sensors/main.c +1 -0
@@ -423,6 +423,7 @@ { "abituguru", print_abituguru }, { "k8temp", print_k8temp }, { "coretemp", print_coretemp }, + { "applesmc", print_applesmc }, { NULL, NULL } };
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 5 lines · Soeren Sonnenburg
this adds support for the sensors found on macbook/pro's etc. It requires applesmc to be loaded and on my mbp c1d I get an amazing 14 (!) sensors (12 temperature, 2 fans in addition to the 2 coretemps).
Please apply!
Patch applied, thanks for your contribution.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors