diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 1b664774..5c255b23 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -69,7 +69,80 @@ void print_lm75(const sensors_chip_name *name) cur,over,hyst); } else printf("ERROR: Can't get temperature data!\n"); - free(label); + free_the_label(&label); +} + +void print_adm1021(const sensors_chip_name *name) +{ + char *label; + double cur,hyst,over; + int alarms,i; + + if (!sensors_get_feature(*name,SENSORS_LM78_ALARMS,&cur)) + alarms = cur + 0.5; + else { + printf("ERROR: Can't get alarm data!\n"); + alarms = 0; + } + + if (!sensors_get_label(*name,SENSORS_ADM1021_TEMP,&label) && + !sensors_get_feature(*name,SENSORS_ADM1021_TEMP,&cur) && + !sensors_get_feature(*name,SENSORS_ADM1021_TEMP_HYST,&hyst) && + !sensors_get_feature(*name,SENSORS_ADM1021_TEMP_OVER,&over)) { + print_label(label,10); + printf("%4.0f C (limit: %4.0f C, hysteresis: %4.0f C) ", + cur,over,hyst); + if (alarms & (ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW)) { + printf("ALARM ("); + i = 0; + if (alarms & ADM1021_ALARM_TEMP_LOW) { + printf("LOW"); + i++; + } + if (alarms & ADM1021_ALARM_TEMP_HIGH) + printf("%sHIGH",i?",":""); + printf(")\n"); + } + } else + printf("ERROR: Can't get temperature data!\n"); + free_the_label(&label); + + if (!sensors_get_label(*name,SENSORS_ADM1021_REMOTE_TEMP,&label) && + !sensors_get_feature(*name,SENSORS_ADM1021_REMOTE_TEMP,&cur) && + !sensors_get_feature(*name,SENSORS_ADM1021_REMOTE_TEMP_HYST,&hyst) && + !sensors_get_feature(*name,SENSORS_ADM1021_REMOTE_TEMP_OVER,&over)) { + print_label(label,10); + printf("%4.0f C (limit: %4.0f C, hysteresis: %4.0f C) ", + cur,over,hyst); + if (alarms & (ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | + ADM1021_ALARM_RTEMP_NA)) { + printf("ALARM ("); + i = 0; + if (alarms & ADM1021_ALARM_RTEMP_NA) { + printf("N/A"); + i++; + } + if (alarms & ADM1021_ALARM_RTEMP_LOW) { + printf("%sLOW",i?",":""); + i++; + } + if (alarms & ADM1021_ALARM_RTEMP_HIGH) + printf("%sHIGH",i?",":""); + printf(")\n"); + } + } else + printf("ERROR: Can't get temperature data!\n"); + free_the_label(&label); + + if (!strcmp(name->prefix,"adm1021")) { + if (!sensors_get_label(*name,SENSORS_ADM1021_DIE_CODE,&label) && + !sensors_get_feature(*name,SENSORS_ADM1021_DIE_CODE,&cur)) { + print_label(label,10); + printf("%4.0f\n",cur); + } else + printf("ERROR: Can't get die-code data!\n"); + free_the_label(&label); + } } void print_lm78(const sensors_chip_name *name) @@ -382,33 +455,6 @@ void print_gl518(const sensors_chip_name *name) free_the_label(&label); } -void print_unknown_chip(const sensors_chip_name *name) -{ - int a,b; - const sensors_feature_data *data; - char *label; - double val; - - a=b=0; - while((data=sensors_get_all_features(*name,&a,&b))) { - if (sensors_get_label(*name,data->number,&label)) { - printf("ERROR: Can't get feature `%s' data!",data->name); - continue; - } - if (data->mode & SENSORS_MODE_R) { - if(sensors_get_feature(*name,data->number,&val)) { - printf("ERROR: Can't get feature `%s' data!",data->name); - continue; - } - if (data->mapping != SENSORS_NO_MAPPING) - printf(" %s: %.2f (%s)\n",label,val,data->name); - else - printf("%s: %.2f (%s)\n",label,val,data->name); - } else - printf("(%s)",label); - } -} - void print_lm80(const sensors_chip_name *name) { char *label = NULL; @@ -1009,3 +1055,31 @@ void print_maxilife(const sensors_chip_name *name) printf("ERROR: Can't get VID4 data!\n"); free_the_label(&label); } + +void print_unknown_chip(const sensors_chip_name *name) +{ + int a,b; + const sensors_feature_data *data; + char *label; + double val; + + a=b=0; + while((data=sensors_get_all_features(*name,&a,&b))) { + if (sensors_get_label(*name,data->number,&label)) { + printf("ERROR: Can't get feature `%s' data!",data->name); + continue; + } + if (data->mode & SENSORS_MODE_R) { + if(sensors_get_feature(*name,data->number,&val)) { + printf("ERROR: Can't get feature `%s' data!",data->name); + continue; + } + if (data->mapping != SENSORS_NO_MAPPING) + printf(" %s: %.2f (%s)\n",label,val,data->name); + else + printf("%s: %.2f (%s)\n",label,val,data->name); + } else + printf("(%s)",label); + } +} + diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index d066bfde..f867a0cb 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -25,6 +25,7 @@ extern void print_unknown_chip(const sensors_chip_name *name); extern void print_lm75(const sensors_chip_name *name); +extern void print_adm1021(const sensors_chip_name *name); extern void print_lm78(const sensors_chip_name *name); extern void print_gl518(const sensors_chip_name *name); extern void print_lm80(const sensors_chip_name *name); diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 63c77db7..e5106518 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -249,6 +249,9 @@ void do_a_print(sensors_chip_name name) printf(" ERROR: Can't get adapter or algorithm?!?\n"); if (!strcmp(name.prefix,"lm75")) print_lm75(&name); + else if (!strcmp(name.prefix,"adm1021") || !strcmp(name.prefix,"max1617") || + !strcmp(name.prefix,"max1617a")) + print_adm1021(&name); else if (!strcmp(name.prefix,"lm78") || !strcmp(name.prefix,"lm78-j") || !strcmp(name.prefix,"lm79") || !strcmp(name.prefix,"sis5595")) print_lm78(&name);