--- xsensors-0.60.orig/src/main.h 2009-02-11 14:12:47.000000000 +0100 +++ xsensors-0.60/src/main.h 2009-02-11 14:57:04.000000000 +0100 @@ -25,21 +25,16 @@ #include #include #include -#include #include #include #include "chips.h" #include "gui.h" /* Version Number */ -#define VERSION "0.60" - -/* Default lm_sensors config file */ -#define DEFAULT_SENS_CONF "/etc/sensors.conf" +#define VERSION "lib3" /* Pretty identifiers. */ enum { SUCCESS, FAILURE }; /* Prototypes */ int help_msg( void ); -int print_features( sensors_chip_name ); --- xsensors-0.60.orig/configure.in 2004-04-05 01:23:01.000000000 +0200 +++ xsensors-0.60/configure.in 2009-02-11 14:12:56.000000000 +0100 @@ -17,7 +17,7 @@ dnl Checks for the sensors library. AC_CHECK_LIB(sensors, sensors_init,[], AC_MSG_ERROR(You need the sensors library)) -AC_CHECK_HEADERS([sensors/sensors.h sensors/chips.h sensors/error.h]) +AC_CHECK_HEADERS([sensors/sensors.h sensors/error.h]) AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([ *** GLib 2.0 is required to build xsensors; please make sure you have the GLib --- xsensors-0.60.orig/src/chips.h 2007-10-09 20:19:11.000000000 +0200 +++ xsensors-0.60/src/chips.h 2009-02-11 15:02:03.000000000 +0100 @@ -24,7 +24,7 @@ * features vary. */ typedef struct _updates { - sensors_chip_name name; + const sensors_chip_name *name; GtkWidget *pbar; GtkWidget *darea; int featnum; @@ -38,34 +38,4 @@ typedef struct _updates { } updates; /* Add a node to the sensor's features linked list. */ -updates *add_node( updates *, sensors_chip_name, GtkWidget *, GtkWidget *, - int ); - -/* Get the number of features of a given sensor. */ -int get_num_feat( sensors_chip_name ); - -/* Feature Info Prototypes */ -int get_feat_info_adm1021( updates *node, sensors_chip_name name, int num ); -int get_feat_info_eeprom( updates *node, sensors_chip_name name, int num ); -int get_feat_info_f71805f( updates *node, sensors_chip_name name, int num ); -int get_feat_info_it87( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm75( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm78( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm78j( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm79( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm80( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm85( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm87( updates *node, sensors_chip_name name, int num ); -int get_feat_info_lm90( updates *node, sensors_chip_name name, int num ); -int get_feat_info_max1617( updates *node, sensors_chip_name name, int num ); -int get_feat_info_max1617a( updates *node, sensors_chip_name name, int num ); -int get_feat_info_smsc47m1( updates *node, sensors_chip_name name, int num ); -int get_feat_info_smsc47m192( updates *node, sensors_chip_name name, int num ); -int get_feat_info_smsc47b397( updates *node, sensors_chip_name name, int num ); -int get_feat_info_via686a( updates *node, sensors_chip_name name, int num ); -int get_feat_info_w83781d( updates *node, sensors_chip_name name, int num ); -int get_feat_info_w83782d( updates *node, sensors_chip_name name, int num ); -int get_feat_info_w83627ehf( updates *node, sensors_chip_name name, int num ); -int get_feat_info_w83783s( updates *node, sensors_chip_name name, int num ); -int get_feat_info_as99127f( updates *node, sensors_chip_name name, int num ); -int get_feat_info_k8temp( updates *node, sensors_chip_name name, int num ); +updates *add_node( const sensors_chip_name *, const sensors_feature * ); --- xsensors-0.60.orig/src/gui.h 2007-10-09 20:19:51.000000000 +0200 +++ xsensors-0.60/src/gui.h 2009-02-11 14:12:56.000000000 +0100 @@ -22,7 +22,7 @@ #include #include -enum { VOLT, TEMP, FAN, EEPROM }; +enum { VOLT, TEMP, FAN }; #define NA "Not Available!" @@ -34,5 +34,5 @@ gboolean expose_event_callback( GtkWidge gint free_llist( updates * ); gint update_sensor_data( gpointer ); gint start_timer( GtkWidget *, gpointer ); -updates *add_sensor_tab( GtkWidget *, sensors_chip_name ); +updates *add_sensor_tab( GtkWidget *, const sensors_chip_name * ); int start_gui( int, char ** ); --- xsensors-0.60.orig/src/gui.c 2007-10-09 20:19:32.000000000 +0200 +++ xsensors-0.60/src/gui.c 2009-02-11 15:02:03.000000000 +0100 @@ -109,8 +109,6 @@ gboolean expose_event_callback( GtkWidge gint result = 0; - double a, b, c, d, tempD; - #ifdef DEBUG_XSENSORS printf( "area.width = %d, area.height = %d\n", event->area.width, event->area.height ); @@ -309,208 +307,6 @@ gboolean expose_event_callback( GtkWidge break; - case EEPROM: - result = (int) current->curvalue; - - /* Special case for know EEPROM types. */ - if ( current->featnum == SENSORS_EEPROM_TYPE ) { - if ( current->curvalue == 4 ) { - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 118, 120, - 0, 0, 98, 30 ); - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 54, 150, - 98, 0, 75, 30 ); - } else if ( current->curvalue == 7 ) { - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 55, 120, - 0, 0, 161, 30 ); - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 54, 150, - 161, 0, 75, 30 ); - } else if ( current->curvalue == 8 ) { - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 55, 120, - 0, 0, 57, 30 ); - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 36, 0, - 57, 0, 18, 30 ); - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 112, 120, - 75, 0, 104, 30 ); - } else { - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 18, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 36, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 54, 0, 18, 30 ); - - if ( result >= 100 ) { - curInt = result / 100; - result = result % 100; - - get_pm_location( curInt, &x ); - } else { - x = 198; - } - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 72, 0, 18, 30 ); - - if ( result >= 10 ) { - curInt = result / 10; - result = result % 10; - - get_pm_location( curInt, &x ); - } else { - x = 198; - } - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 90, 0, 18, 30 ); - - curInt = result; - - get_pm_location( curInt, &x ); - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 108, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 126, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 144, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 162, 0, 18, 30 ); - - } - } else { - sensors_get_feature( current->name, SENSORS_EEPROM_TYPE, - &tempD ); - if ( tempD == 4.0 || tempD == 7.0 || tempD == 8.0 ) { - sensors_get_feature(current->name, SENSORS_EEPROM_ROWADDR, - &a); - sensors_get_feature(current->name, SENSORS_EEPROM_COLADDR, - &b); - sensors_get_feature(current->name, SENSORS_EEPROM_NUMROWS, - &c); - sensors_get_feature(current->name, SENSORS_EEPROM_BANKS, - &d); - result = (((int) a) & 0x0f) + (((int) b) & 0x0f) - 17; - - if ( tempD == 8.0 ) { /* DDR2 */ - result = (1 << result) * ((((int) c) & 0x07) + 1) - * ((int) d); - - } else if ( result > 0 && result <= 12 && c <= 8 && d <= 8 ) - { - result = (1 << result) * ((int) c) * ((int) d); - } - } - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 18, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 36, 0, 18, 30 ); - - if ( result >= 1000 ) { - curInt = result / 1000; - result = result % 1000; - - get_pm_location( curInt, &x ); - } else { - x = 198; - } - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 54, 0, 18, 30 ); - - if ( result >= 100 || x != 198 ) { - curInt = result / 100; - result = result % 100; - - get_pm_location( curInt, &x ); - } - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 72, 0, 18, 30 ); - - if ( result >= 10 || x != 198 ) { - curInt = result / 10; - result = result % 10; - - get_pm_location( curInt, &x ); - } - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 90, 0, 18, 30 ); - - curInt = result; - - get_pm_location( curInt, &x ); - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, x, highLow, - 108, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 126, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 144, 0, 18, 30 ); - - gdk_draw_drawable( widget->window, - widget->style->fg_gc[ GTK_WIDGET_STATE - (widget) ], theme, 198, highLow, - 162, 0, 18, 30 ); - - } - - break; default: break; } @@ -536,46 +332,44 @@ gint update_sensor_data( gpointer data ) gfloat percent = 0; do { - if ( sensors_get_feature( updata->name, updata->featnum, + if ( sensors_get_value( updata->name, updata->featnum, &(updata->curvalue) ) != 0 ) { updata->curvalue = 0; } if ( updata->featminnum != UNDEFMAXMIN ) { - sensors_get_feature( updata->name, updata->featminnum, - &(updata->curmin) ); + sensors_get_value( updata->name, updata->featminnum, + &(updata->curmin) ); } else { updata->curmin = 0; } if ( updata->featmaxnum != UNDEFMAXMIN ) { - sensors_get_feature( updata->name, updata->featmaxnum, - &(updata->curmax) ); + sensors_get_value( updata->name, updata->featmaxnum, + &(updata->curmax) ); } else { updata->curmax = 10000; } - if ( updata->feattype != EEPROM ) { - if (updata->curmax != updata->curmin ) { - percent = ( ( updata->curvalue - updata->curmin ) / - ( updata->curmax - updata->curmin ) ); - } else { - percent = 0.0; - } + if (updata->curmax != updata->curmin ) { + percent = ( ( updata->curvalue - updata->curmin ) / + ( updata->curmax - updata->curmin ) ); + } else { + percent = 0.0; + } #ifdef DEBUG_XSENSORS - printf( "curvalue = %f, curmax = %f, curmin = %f, percent = %f\n", - updata->curvalue, updata->curmax, updata->curmin, percent ); + printf( "curvalue = %f, curmax = %f, curmin = %f, percent = %f\n", + updata->curvalue, updata->curmax, updata->curmin, percent ); #endif - - if ( percent < 0 ) - percent = 0; - if ( percent > 1 ) - percent = 1; + if ( percent < 0 ) + percent = 0; - gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR (updata->pbar), - percent ); - } + if ( percent > 1 ) + percent = 1; + + gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR (updata->pbar), + percent ); gtk_widget_queue_draw_area( updata->darea, 0, 0, 153, 30 ); @@ -602,13 +396,12 @@ gint start_timer( GtkWidget *widget, gpo return SUCCESS; } -updates *add_sensor_tab( GtkWidget *container, sensors_chip_name name ) { +updates *add_sensor_tab( GtkWidget *container, const sensors_chip_name *name ) { /* packing boxes */ GtkWidget *mainbox = NULL; GtkWidget *voltbox = NULL; GtkWidget *tempbox = NULL; GtkWidget *fanbox = NULL; - GtkWidget *eeprombox = NULL; GtkWidget *currbox = NULL; GtkWidget *innerbox = NULL; @@ -620,23 +413,19 @@ updates *add_sensor_tab( GtkWidget *cont GtkWidget *voltlabel = NULL; GtkWidget *templabel = NULL; GtkWidget *fanlabel = NULL; - GtkWidget *eepromlabel = NULL; /* feature data */ updates *head = NULL; updates *current = NULL, *prev = NULL; + const sensors_feature *feature; + /* several needed ints */ - int numfeat = 0; int i = 0; int usedvolt = 0; int usedtemp = 0; int usedfan = 0; - int usedeeprom = 0; - int valid = 0; - double value = 0; - /* fields placed in the notebook to display feature info */ GtkWidget *darea = NULL; char *feattext = NULL; @@ -650,14 +439,13 @@ updates *add_sensor_tab( GtkWidget *cont voltbox = gtk_vbox_new( FALSE, 0 ); tempbox = gtk_vbox_new( FALSE, 0 ); fanbox = gtk_vbox_new( FALSE, 0 ); - eeprombox = gtk_vbox_new( FALSE, 0 ); /* Create notebook for sensors. */ noteframe = gtk_frame_new( NULL ); gtk_container_set_border_width( GTK_CONTAINER (noteframe), 10 ); gtk_widget_show( noteframe ); - notelabel = gtk_label_new( name.prefix ); + notelabel = gtk_label_new( name->prefix ); gtk_widget_show( notelabel ); gtk_container_add( GTK_CONTAINER (noteframe), mainbox ); @@ -667,15 +455,16 @@ updates *add_sensor_tab( GtkWidget *cont voltlabel = gtk_label_new( "Voltages:" ); templabel = gtk_label_new( "Temperatures:" ); fanlabel = gtk_label_new( "Fans:" ); - eepromlabel = gtk_label_new( "EEPROM:" ); gtk_box_pack_start( GTK_BOX (voltbox), voltlabel, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX (tempbox), templabel, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX (fanbox), fanlabel, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX (eeprombox), eepromlabel, FALSE, FALSE, 0 ); /* Create labels and entry fields for features. */ - numfeat = get_num_feat( name ); - for ( i = 1; i <= numfeat; i++ ) { + while ( (feature = sensors_get_features( name, &i )) ) { + updates *new_node = add_node( name, feature ); + if ( new_node == NULL ) + continue; + featframe = gtk_frame_new( NULL ); innerbox = gtk_vbox_new( FALSE, 0 ); featpbar = gtk_progress_bar_new(); @@ -683,38 +472,24 @@ updates *add_sensor_tab( GtkWidget *cont gtk_widget_modify_bg( darea, GTK_STATE_NORMAL, &colorWhite ); gtk_widget_set_size_request( darea, 36, 30 ); + new_node->darea = darea; + new_node->pbar = featpbar; + if ( head == NULL ) { prev = head; - head = current = add_node( head, name, darea, featpbar, i ); + head = current = new_node; } else { prev = current; - current = current->next = - add_node( current->next, name, darea, featpbar, i ); - } - - if ( current->featnum == SENSORS_EEPROM_TYPE ) - gtk_widget_set_size_request( darea, 236, 30 ); - - if ( sensors_get_ignored( current->name, current->featnum ) == 0 ) { - if ( prev == NULL ) { - head = NULL; - } else { - prev->next = current->next; - } - g_free( current ); - current = prev; - continue; + current = current->next = new_node; } /* Connect the expose event sinal handler to redraw the numbers. */ g_signal_connect( G_OBJECT(darea), "expose_event", G_CALLBACK(expose_event_callback), current ); - sensors_get_label( name, current->featnum, &feattext); + feattext = sensors_get_label( name, feature ); - valid=(sensors_get_feature( name, current->featnum, &value))?0:1; - - if ( ( feattext != NULL ) && (valid) ) { + if ( feattext != NULL ) { #ifdef DEBUG_XSENSORS printf( "Adding feature %d, %s.\n", i, feattext ); #endif @@ -744,10 +519,6 @@ updates *add_sensor_tab( GtkWidget *cont currbox = fanbox; usedfan++; break; - case EEPROM: - currbox = eeprombox; - usedeeprom++; - break; default: fprintf( stderr, "Type not recognized, not packing.\n" ); @@ -759,9 +530,8 @@ updates *add_sensor_tab( GtkWidget *cont gtk_box_pack_start( GTK_BOX (innerbox), darea, FALSE, FALSE, 0 ); - if ( current->feattype != EEPROM ) - gtk_box_pack_start( GTK_BOX (innerbox), featpbar, - FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX (innerbox), featpbar, + FALSE, FALSE, 0 ); } else { gtk_frame_set_label( GTK_FRAME (featframe), feattext ); @@ -769,8 +539,7 @@ updates *add_sensor_tab( GtkWidget *cont gtk_widget_show( featframe ); gtk_widget_show( innerbox ); gtk_widget_show( darea ); - if ( current->feattype != EEPROM ) - gtk_widget_show( featpbar ); + gtk_widget_show( featpbar ); g_free( feattext ); feattext = NULL; } @@ -793,12 +562,6 @@ updates *add_sensor_tab( GtkWidget *cont gtk_widget_show( fanlabel ); } - if ( usedeeprom > 0 ) { - gtk_widget_show( eeprombox ); - gtk_box_pack_start( GTK_BOX (mainbox), eeprombox, FALSE, FALSE, 0 ); - gtk_widget_show( eepromlabel ); - } - g_free( feattext ); return head; @@ -879,20 +642,17 @@ int start_gui( int argc, char **argv ) { gtk_container_add( GTK_CONTAINER (mainwindow), notebook ); - while ( ( name = sensors_get_detected_chips( &chipnum ) ) != NULL ) { - if ( get_num_feat( *name ) > 0 ) { + while ( ( name = sensors_get_detected_chips( NULL, &chipnum ) ) != NULL ) { + if ( 1 ) { #ifdef DEBUG_XSENSORS printf( "Adding tab for %s\n", name->prefix ); #endif - if ( ( head = add_sensor_tab( notebook, *name ) ) == NULL ) + if ( ( head = add_sensor_tab( notebook, name ) ) == NULL ) return FAILURE; update_sensor_data( head ); g_signal_connect( G_OBJECT (mainwindow), "realize", G_CALLBACK (start_timer), head ); - } else { - fprintf( stderr, "Sensor '%s' not supported by xsensors!\n", - name->prefix ); } } --- xsensors-0.60.orig/src/main.c 2009-02-11 14:12:47.000000000 +0100 +++ xsensors-0.60/src/main.c 2009-02-11 15:00:49.000000000 +0100 @@ -44,7 +44,7 @@ int help_msg( void ) { "--------\n\n" "-f\t\tDisplay all temperatures in Fahrenheit.\n" "-h\t\tDisplay this help text and exit.\n" - "-c filename\tSpecify the lm_sensors configuration file.\n" + "-c filename\tSpecify the libsensors configuration file.\n" "-i filename\tSpecify the image file to use as a theme.\n" "-t time\t\tSpecify the update time in number of seconds.\n" "\t\tSet this to a negative number for no update.\n" @@ -55,40 +55,6 @@ int help_msg( void ) { return SUCCESS; } -/* Prints out the chips' labels and features. Mainly used for debugging. */ -#ifdef DEBUG_XSENSORS -int print_features( sensors_chip_name name ) { - int featnum = 1; - char *labelresult = NULL; - double featureresult = 0; - - printf( "Sensor: %s\n", name.prefix ); - - /* Aparently none of the features are defined over 99 so go through all - * up until that and list those that return successfully. - */ - while ( featnum < 99 ) { - - if ( sensors_get_label( name, featnum, &labelresult ) == 0 ) { - if ( sensors_get_feature( name, featnum, &featureresult ) != 0 ) { - fprintf( stderr, "Could not get feature!\n" ); - return FAILURE; - } - } - - if ( labelresult != NULL ) { - printf( "%s: %f\n", labelresult, featureresult ); - } - - featnum++; - } - - free( labelresult ); - - return SUCCESS; -} -#endif /* DEBUG_XSENSORS */ - /* Main. */ int main( int argc, char **argv ) { int c = 0; @@ -139,15 +105,10 @@ int main( int argc, char **argv ) { } } - /* If lm_sensors config file was not specified, use default. */ - if ( sens_config == NULL ) - sens_config = strdup( DEFAULT_SENS_CONF ); - - /* Open the config file. */ - if ( ( sens_conf_file = fopen( sens_config, "r" ) ) == NULL ) { + /* Open the config file if specified. */ + if ( sens_config && + ( sens_conf_file = fopen( sens_config, "r" ) ) == NULL ) { fprintf( stderr, "Error opening config file: %s\n" - "Use -c option to specify location of lm_sensors" - " configuration file.\n" , sens_config ); return EXIT_FAILURE; } @@ -168,12 +129,13 @@ int main( int argc, char **argv ) { /* Clean up the sensors library. */ sensors_cleanup(); - free( sens_config ); + if ( sens_config != NULL ) + free( sens_config ); if ( imagefile != NULL ) free( imagefile ); /* Close the config file. */ - if ( fclose( sens_conf_file ) != SUCCESS ) { + if ( sens_conf_file && fclose( sens_conf_file ) != SUCCESS ) { fprintf( stderr, "Something has gone wrong closing the config file!\n" ); return EXIT_FAILURE; --- xsensors-0.60.orig/src/chips.c 2007-10-09 20:18:45.000000000 +0200 +++ xsensors-0.60/src/chips.c 2009-02-11 15:02:03.000000000 +0100 @@ -20,1670 +20,66 @@ #include "main.h" -#define ADM1021_NUM_FEAT 2 - -/* Get the feature info for adm1021 sensor. */ -int get_feat_info_adm1021( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_ADM1021_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_ADM1021_TEMP_OVER; - node->feattype = TEMP; - break; - case 2: - node->featnum = SENSORS_ADM1021_REMOTE_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_ADM1021_REMOTE_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define EEPROM_NUM_FEAT 2 /* Was 5, see comment below. */ - -/* Get the feature info for eeprom. */ -int get_feat_info_eeprom( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_EEPROM_TYPE; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = EEPROM; - break; - case 2: - node->featnum = SENSORS_EEPROM_ROWADDR; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = EEPROM; - break; -#if 0 /* Removed so that we can now compute the memory size. */ - case 3: - node->featnum = SENSORS_EEPROM_COLADDR; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = EEPROM; - break; - case 4: - node->featnum = SENSORS_EEPROM_NUMROWS; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = EEPROM; - break; - case 5: - node->featnum = SENSORS_EEPROM_BANKS; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = EEPROM; - break; -#endif - default: - return FAILURE; - } - - return SUCCESS; -} - -#define F71805F_NUM_FEAT 15 - -int get_feat_info_f71805f( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - node->featnum = SENSORS_F71805F_IN(num - 1); - node->featminnum = SENSORS_F71805F_IN_MIN(num - 1); - node->featmaxnum = SENSORS_F71805F_IN_MAX(num - 1); - node->feattype = VOLT; - break; - case 10: - case 11: - case 12: - node->featnum = SENSORS_F71805F_FAN(num - 9); - node->featminnum = SENSORS_F71805F_FAN_MIN(num - 9); - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 13: - case 14: - case 15: - node->featnum = SENSORS_F71805F_TEMP(num - 12); - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_F71805F_TEMP_MAX(num - 12); - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define IT87_NUM_FEAT 15 - -/* Get the feature info for lm87 sensor. */ -int get_feat_info_it87( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_IT87_IN0; - node->featminnum = SENSORS_IT87_IN0_MIN; - node->featmaxnum = SENSORS_IT87_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_IT87_IN1; - node->featminnum = SENSORS_IT87_IN1_MIN; - node->featmaxnum = SENSORS_IT87_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_IT87_IN2; - node->featminnum = SENSORS_IT87_IN2_MIN; - node->featmaxnum = SENSORS_IT87_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_IT87_IN3; - node->featminnum = SENSORS_IT87_IN3_MIN; - node->featmaxnum = SENSORS_IT87_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_IT87_IN4; - node->featminnum = SENSORS_IT87_IN4_MIN; - node->featmaxnum = SENSORS_IT87_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_IT87_IN5; - node->featminnum = SENSORS_IT87_IN5_MIN; - node->featmaxnum = SENSORS_IT87_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_IT87_IN6; - node->featminnum = SENSORS_IT87_IN6_MIN; - node->featmaxnum = SENSORS_IT87_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_IT87_IN7; - node->featminnum = SENSORS_IT87_IN7_MIN; - node->featmaxnum = SENSORS_IT87_IN7_MAX; - node->feattype = VOLT; - break; - case 9: - node->featnum = SENSORS_IT87_IN8; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = VOLT; - break; - case 10: - node->featnum = SENSORS_IT87_FAN1; - node->featminnum = SENSORS_IT87_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_IT87_FAN2; - node->featminnum = SENSORS_IT87_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 12: - node->featnum = SENSORS_IT87_FAN3; - node->featminnum = SENSORS_IT87_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 13: - node->featnum = SENSORS_IT87_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_IT87_TEMP1_HIGH; - node->feattype = TEMP; - break; - case 14: - node->featnum = SENSORS_IT87_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_IT87_TEMP2_HIGH; - node->feattype = TEMP; - break; - case 15: - node->featnum = SENSORS_IT87_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_IT87_TEMP3_HIGH; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define LM75_NUM_FEAT 1 - -/* Get the feature info for lm75 sensor. */ -int get_feat_info_lm75( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM75_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM75_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define LM78_NUM_FEAT 11 - -/* Get the feature info for lm78 sensor. */ -int get_feat_info_lm78( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM78_IN0; - node->featminnum = SENSORS_LM78_IN0_MIN; - node->featmaxnum = SENSORS_LM78_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_LM78_IN1; - node->featminnum = SENSORS_LM78_IN1_MIN; - node->featmaxnum = SENSORS_LM78_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_LM78_IN2; - node->featminnum = SENSORS_LM78_IN2_MIN; - node->featmaxnum = SENSORS_LM78_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_LM78_IN3; - node->featminnum = SENSORS_LM78_IN3_MIN; - node->featmaxnum = SENSORS_LM78_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_LM78_IN4; - node->featminnum = SENSORS_LM78_IN4_MIN; - node->featmaxnum = SENSORS_LM78_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_LM78_IN5; - node->featminnum = SENSORS_LM78_IN5_MIN; - node->featmaxnum = SENSORS_LM78_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_LM78_IN6; - node->featminnum = SENSORS_LM78_IN6_MIN; - node->featmaxnum = SENSORS_LM78_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_LM78_FAN1; - node->featminnum = SENSORS_LM78_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_LM78_FAN2; - node->featminnum = SENSORS_LM78_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_LM78_FAN3; - node->featminnum = SENSORS_LM78_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_LM78_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM78_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - -#define LM78J_NUM_FEAT 11 - -/* Get the feature info for lm78 sensor. */ -int get_feat_info_lm78j( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM78J_IN0; - node->featminnum = SENSORS_LM78J_IN0_MIN; - node->featmaxnum = SENSORS_LM78J_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_LM78J_IN1; - node->featminnum = SENSORS_LM78J_IN1_MIN; - node->featmaxnum = SENSORS_LM78J_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_LM78J_IN2; - node->featminnum = SENSORS_LM78J_IN2_MIN; - node->featmaxnum = SENSORS_LM78J_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_LM78J_IN3; - node->featminnum = SENSORS_LM78J_IN3_MIN; - node->featmaxnum = SENSORS_LM78J_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_LM78J_IN4; - node->featminnum = SENSORS_LM78J_IN4_MIN; - node->featmaxnum = SENSORS_LM78J_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_LM78J_IN5; - node->featminnum = SENSORS_LM78J_IN5_MIN; - node->featmaxnum = SENSORS_LM78J_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_LM78J_IN6; - node->featminnum = SENSORS_LM78J_IN6_MIN; - node->featmaxnum = SENSORS_LM78J_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_LM78J_FAN1; - node->featminnum = SENSORS_LM78J_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_LM78J_FAN2; - node->featminnum = SENSORS_LM78J_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_LM78J_FAN3; - node->featminnum = SENSORS_LM78J_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_LM78J_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM78J_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - -#define LM79_NUM_FEAT 11 - -/* Get the feature info for lm78 sensor. */ -int get_feat_info_lm79( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM79_IN0; - node->featminnum = SENSORS_LM79_IN0_MIN; - node->featmaxnum = SENSORS_LM79_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_LM79_IN1; - node->featminnum = SENSORS_LM79_IN1_MIN; - node->featmaxnum = SENSORS_LM79_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_LM79_IN2; - node->featminnum = SENSORS_LM79_IN2_MIN; - node->featmaxnum = SENSORS_LM79_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_LM79_IN3; - node->featminnum = SENSORS_LM79_IN3_MIN; - node->featmaxnum = SENSORS_LM79_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_LM79_IN4; - node->featminnum = SENSORS_LM79_IN4_MIN; - node->featmaxnum = SENSORS_LM79_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_LM79_IN5; - node->featminnum = SENSORS_LM79_IN5_MIN; - node->featmaxnum = SENSORS_LM79_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_LM79_IN6; - node->featminnum = SENSORS_LM79_IN6_MIN; - node->featmaxnum = SENSORS_LM79_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_LM79_FAN1; - node->featminnum = SENSORS_LM79_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_LM79_FAN2; - node->featminnum = SENSORS_LM79_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_LM79_FAN3; - node->featminnum = SENSORS_LM79_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_LM79_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM79_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - - -#define LM80_NUM_FEAT 10 - -/* Get the feature info for lm80 sensor. */ -int get_feat_info_lm80( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM80_IN0; - node->featminnum = SENSORS_LM80_IN0_MIN; - node->featmaxnum = SENSORS_LM80_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_LM80_IN1; - node->featminnum = SENSORS_LM80_IN1_MIN; - node->featmaxnum = SENSORS_LM80_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_LM80_IN2; - node->featminnum = SENSORS_LM80_IN2_MIN; - node->featmaxnum = SENSORS_LM80_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_LM80_IN3; - node->featminnum = SENSORS_LM80_IN3_MIN; - node->featmaxnum = SENSORS_LM80_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_LM80_IN4; - node->featminnum = SENSORS_LM80_IN4_MIN; - node->featmaxnum = SENSORS_LM80_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_LM80_IN5; - node->featminnum = SENSORS_LM80_IN5_MIN; - node->featmaxnum = SENSORS_LM80_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_LM80_IN6; - node->featminnum = SENSORS_LM80_IN6_MIN; - node->featmaxnum = SENSORS_LM80_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_LM80_FAN1; - node->featminnum = SENSORS_LM80_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_LM80_FAN2; - node->featminnum = SENSORS_LM80_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_LM80_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM80_TEMP_HOT_MAX; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - -#define LM85_NUM_FEAT 12 - -/* Get the feature info for lm87 sensor. */ -int get_feat_info_lm85( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM85_IN0; - node->featminnum = SENSORS_LM85_IN0_MIN; - node->featmaxnum = SENSORS_LM85_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_LM85_IN1; - node->featminnum = SENSORS_LM85_IN1_MIN; - node->featmaxnum = SENSORS_LM85_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_LM85_IN2; - node->featminnum = SENSORS_LM85_IN2_MIN; - node->featmaxnum = SENSORS_LM85_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_LM85_IN3; - node->featminnum = SENSORS_LM85_IN3_MIN; - node->featmaxnum = SENSORS_LM85_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_LM85_IN4; - node->featminnum = SENSORS_LM85_IN4_MIN; - node->featmaxnum = SENSORS_LM85_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_LM85_FAN1; - node->featminnum = SENSORS_LM85_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 7: - node->featnum = SENSORS_LM85_FAN2; - node->featminnum = SENSORS_LM85_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 8: - node->featnum = SENSORS_LM85_FAN3; - node->featminnum = SENSORS_LM85_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_LM85_FAN4; - node->featminnum = SENSORS_LM85_FAN4_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_LM85_TEMP1; - node->featminnum = SENSORS_LM85_TEMP1_MIN; - node->featmaxnum = SENSORS_LM85_TEMP1_MAX; - node->feattype = TEMP; - break; - case 11: - node->featnum = SENSORS_LM85_TEMP2; - node->featminnum = SENSORS_LM85_TEMP2_MIN; - node->featmaxnum = SENSORS_LM85_TEMP2_MAX; - node->feattype = TEMP; - break; - case 12: - node->featnum = SENSORS_LM85_TEMP3; - node->featminnum = SENSORS_LM85_TEMP3_MIN; - node->featmaxnum = SENSORS_LM85_TEMP3_MAX; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - -#define LM87_NUM_FEAT 13 - -/* Get the feature info for lm87 sensor. */ -int get_feat_info_lm87( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM87_IN0; - node->featminnum = SENSORS_LM87_IN0_MIN; - node->featmaxnum = SENSORS_LM87_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_LM87_IN1; - node->featminnum = SENSORS_LM87_IN1_MIN; - node->featmaxnum = SENSORS_LM87_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_LM87_IN2; - node->featminnum = SENSORS_LM87_IN2_MIN; - node->featmaxnum = SENSORS_LM87_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_LM87_IN3; - node->featminnum = SENSORS_LM87_IN3_MIN; - node->featmaxnum = SENSORS_LM87_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_LM87_IN4; - node->featminnum = SENSORS_LM87_IN4_MIN; - node->featmaxnum = SENSORS_LM87_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_LM87_IN5; - node->featminnum = SENSORS_LM87_IN5_MIN; - node->featmaxnum = SENSORS_LM87_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_LM87_AIN1; - node->featminnum = SENSORS_LM87_AIN1_MIN; - node->featmaxnum = SENSORS_LM87_AIN1_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_LM87_AIN2; - node->featminnum = SENSORS_LM87_AIN2_MIN; - node->featmaxnum = SENSORS_LM87_AIN2_MAX; - node->feattype = VOLT; - break; - case 9: - node->featnum = SENSORS_LM87_FAN1; - node->featminnum = SENSORS_LM87_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_LM87_FAN2; - node->featminnum = SENSORS_LM87_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_LM87_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM87_TEMP1_OVER; - node->feattype = TEMP; - break; - case 12: - node->featnum = SENSORS_LM87_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM87_TEMP2_OVER; - node->feattype = TEMP; - break; - case 13: - node->featnum = SENSORS_LM87_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_LM87_TEMP3_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - -#define LM90_NUM_FEAT 2 - -/* Get the feature info for lm90 sensor. */ -int get_feat_info_lm90( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_LM90_LOCAL_TEMP; - node->featminnum = SENSORS_LM90_LOCAL_LOW; - node->featmaxnum = SENSORS_LM90_LOCAL_HIGH; - node->feattype = TEMP; - break; - case 2: - node->featnum = SENSORS_LM90_REMOTE_TEMP; - node->featminnum = SENSORS_LM90_REMOTE_LOW; - node->featmaxnum = SENSORS_LM90_REMOTE_HIGH; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - -#define MAX1617_NUM_FEAT 2 - -/* Get the feature info for max1617 sensor. */ -int get_feat_info_max1617( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_MAX1617_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_MAX1617_TEMP_OVER; - node->feattype = TEMP; - break; - case 2: - node->featnum = SENSORS_MAX1617_REMOTE_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_MAX1617_REMOTE_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define MAX1617A_NUM_FEAT 2 - -/* Get the feature info for max1617a sensor. */ -int get_feat_info_max1617a( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_MAX1617A_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_MAX1617A_TEMP_OVER; - node->feattype = TEMP; - break; - case 2: - node->featnum = SENSORS_MAX1617A_REMOTE_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_MAX1617A_REMOTE_TEMP_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define SMSC47M1_NUM_FEAT 2 - -/* Get the feature info for smsc47m1 sensor. */ -int get_feat_info_smsc47m1( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_SMSC47M1_FAN1; - node->featminnum = SENSORS_SMSC47M1_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 2: - node->featnum = SENSORS_SMSC47M1_FAN2; - node->featminnum = SENSORS_SMSC47M1_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define SMSC47M192_NUM_FEAT 11 - -/* Get the feature info for smsc47m192 sensor. */ -int get_feat_info_smsc47m192( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - node->featnum = SENSORS_SMSC47M192_IN(num - 1); - node->featminnum = SENSORS_SMSC47M192_IN_MIN(num - 1); - node->featmaxnum = SENSORS_SMSC47M192_IN_MAX(num - 1); - node->feattype = VOLT; - break; - case 9: - case 10: - case 11: - node->featnum = SENSORS_SMSC47M192_TEMP(num - 8); - node->featminnum = SENSORS_SMSC47M192_TEMP_MIN(num - 8); - node->featmaxnum = SENSORS_SMSC47M192_TEMP_MAX(num - 8); - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define SMSC47B397_NUM_FEAT 8 - -/* Get the feature info for smsc47b397 sensor. */ -int get_feat_info_smsc47b397( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_SMSC47B397_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 2: - node->featnum = SENSORS_SMSC47B397_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 3: - node->featnum = SENSORS_SMSC47B397_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 4: - node->featnum = SENSORS_SMSC47B397_TEMP4; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 5: - node->featnum = SENSORS_SMSC47B397_FAN1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 6: - node->featnum = SENSORS_SMSC47B397_FAN2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 7: - node->featnum = SENSORS_SMSC47B397_FAN3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 8: - node->featnum = SENSORS_SMSC47B397_FAN4; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - - -#define VIA686A_NUM_FEAT 10 - -/* Get the feature info for via686a sensor. */ -int get_feat_info_via686a( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_VIA686A_IN0; - node->featminnum = SENSORS_VIA686A_IN0_MIN; - node->featmaxnum = SENSORS_VIA686A_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_VIA686A_IN1; - node->featminnum = SENSORS_VIA686A_IN1_MIN; - node->featmaxnum = SENSORS_VIA686A_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_VIA686A_IN2; - node->featminnum = SENSORS_VIA686A_IN2_MIN; - node->featmaxnum = SENSORS_VIA686A_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_VIA686A_IN3; - node->featminnum = SENSORS_VIA686A_IN3_MIN; - node->featmaxnum = SENSORS_VIA686A_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_VIA686A_IN4; - node->featminnum = SENSORS_VIA686A_IN4_MIN; - node->featmaxnum = SENSORS_VIA686A_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_VIA686A_FAN1; - node->featminnum = SENSORS_VIA686A_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 7: - node->featnum = SENSORS_VIA686A_FAN2; - node->featminnum = SENSORS_VIA686A_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 8: - node->featnum = SENSORS_VIA686A_TEMP; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_VIA686A_TEMP_OVER; - node->feattype = TEMP; - break; - case 9: - node->featnum = SENSORS_VIA686A_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_VIA686A_TEMP2_OVER; - node->feattype = TEMP; - break; - case 10: - node->featnum = SENSORS_VIA686A_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_VIA686A_TEMP3_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define W83781D_NUM_FEAT 13 - -/* Get the feature info for w83781d sensor. */ -int get_feat_info_w83781d( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_W83781D_IN0; - node->featminnum = SENSORS_W83781D_IN0_MIN; - node->featmaxnum = SENSORS_W83781D_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_W83781D_IN1; - node->featminnum = SENSORS_W83781D_IN1_MIN; - node->featmaxnum = SENSORS_W83781D_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_W83781D_IN2; - node->featminnum = SENSORS_W83781D_IN2_MIN; - node->featmaxnum = SENSORS_W83781D_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_W83781D_IN3; - node->featminnum = SENSORS_W83781D_IN3_MIN; - node->featmaxnum = SENSORS_W83781D_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_W83781D_IN4; - node->featminnum = SENSORS_W83781D_IN4_MIN; - node->featmaxnum = SENSORS_W83781D_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_W83781D_IN5; - node->featminnum = SENSORS_W83781D_IN5_MIN; - node->featmaxnum = SENSORS_W83781D_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_W83781D_IN6; - node->featminnum = SENSORS_W83781D_IN6_MIN; - node->featmaxnum = SENSORS_W83781D_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_W83781D_FAN1; - node->featminnum = SENSORS_W83781D_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_W83781D_FAN2; - node->featminnum = SENSORS_W83781D_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_W83781D_FAN3; - node->featminnum = SENSORS_W83781D_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_W83781D_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83781D_TEMP1_OVER; - node->feattype = TEMP; - break; - case 12: - node->featnum = SENSORS_W83781D_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83781D_TEMP2_OVER; - node->feattype = TEMP; - break; - case 13: - node->featnum = SENSORS_W83781D_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83781D_TEMP3_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define W83782D_NUM_FEAT 15 - -/* Get the feature info for w83782d sensor. */ -int get_feat_info_w83782d( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_W83782D_IN0; - node->featminnum = SENSORS_W83782D_IN0_MIN; - node->featmaxnum = SENSORS_W83782D_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_W83782D_IN1; - node->featminnum = SENSORS_W83782D_IN1_MIN; - node->featmaxnum = SENSORS_W83782D_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_W83782D_IN2; - node->featminnum = SENSORS_W83782D_IN2_MIN; - node->featmaxnum = SENSORS_W83782D_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_W83782D_IN3; - node->featminnum = SENSORS_W83782D_IN3_MIN; - node->featmaxnum = SENSORS_W83782D_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_W83782D_IN4; - node->featminnum = SENSORS_W83782D_IN4_MIN; - node->featmaxnum = SENSORS_W83782D_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_W83782D_IN5; - node->featminnum = SENSORS_W83782D_IN5_MIN; - node->featmaxnum = SENSORS_W83782D_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_W83782D_IN6; - node->featminnum = SENSORS_W83782D_IN6_MIN; - node->featmaxnum = SENSORS_W83782D_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_W83782D_IN7; - node->featminnum = SENSORS_W83782D_IN7_MIN; - node->featmaxnum = SENSORS_W83782D_IN7_MAX; - node->feattype = VOLT; - break; - case 9: - node->featnum = SENSORS_W83782D_IN8; - node->featminnum = SENSORS_W83782D_IN8_MIN; - node->featmaxnum = SENSORS_W83782D_IN8_MAX; - node->feattype = VOLT; - break; - case 10: - node->featnum = SENSORS_W83782D_FAN1; - node->featminnum = SENSORS_W83782D_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_W83782D_FAN2; - node->featminnum = SENSORS_W83782D_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 12: - node->featnum = SENSORS_W83782D_FAN3; - node->featminnum = SENSORS_W83782D_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 13: - node->featnum = SENSORS_W83782D_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83782D_TEMP1_OVER; - node->feattype = TEMP; - break; - case 14: - node->featnum = SENSORS_W83782D_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83782D_TEMP2_OVER; - node->feattype = TEMP; - break; - case 15: - node->featnum = SENSORS_W83782D_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83782D_TEMP3_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - - -#define W83627EHF_NUM_FEAT 16 - -/* Get the feature info for w83627ehf sensor. */ -int get_feat_info_w83627ehf( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_W83627EHF_IN0; - node->featminnum = SENSORS_W83627EHF_IN0_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_W83627EHF_IN1; - node->featminnum = SENSORS_W83627EHF_IN1_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_W83627EHF_IN2; - node->featminnum = SENSORS_W83627EHF_IN2_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_W83627EHF_IN3; - node->featminnum = SENSORS_W83627EHF_IN3_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_W83627EHF_IN4; - node->featminnum = SENSORS_W83627EHF_IN4_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_W83627EHF_IN5; - node->featminnum = SENSORS_W83627EHF_IN5_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_W83627EHF_IN6; - node->featminnum = SENSORS_W83627EHF_IN6_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_W83627EHF_IN7; - node->featminnum = SENSORS_W83627EHF_IN7_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN7_MAX; - node->feattype = VOLT; - break; - case 9: - node->featnum = SENSORS_W83627EHF_IN8; - node->featminnum = SENSORS_W83627EHF_IN8_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN8_MAX; - node->feattype = VOLT; - break; - case 10: - node->featnum = SENSORS_W83627EHF_IN9; - node->featminnum = SENSORS_W83627EHF_IN9_MIN; - node->featmaxnum = SENSORS_W83627EHF_IN9_MAX; - node->feattype = VOLT; - break; - case 11: - node->featnum = SENSORS_W83627EHF_FAN1; - node->featminnum = SENSORS_W83627EHF_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 12: - node->featnum = SENSORS_W83627EHF_FAN2; - node->featminnum = SENSORS_W83627EHF_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 13: - node->featnum = SENSORS_W83627EHF_FAN3; - node->featminnum = SENSORS_W83627EHF_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 14: - node->featnum = SENSORS_W83627EHF_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83627EHF_TEMP1_OVER; - node->feattype = TEMP; - break; - case 15: - node->featnum = SENSORS_W83627EHF_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83627EHF_TEMP2_OVER; - node->feattype = TEMP; - break; - case 16: - node->featnum = SENSORS_W83627EHF_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83627EHF_TEMP3_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - - - - -#define W83783S_NUM_FEAT 12 - -/* Get the feature info for w83783s and w83697hf sensor. */ -int get_feat_info_w83783s( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_W83783S_IN0; - node->featminnum = SENSORS_W83783S_IN0_MIN; - node->featmaxnum = SENSORS_W83783S_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_W83783S_IN1; - node->featminnum = SENSORS_W83783S_IN1_MIN; - node->featmaxnum = SENSORS_W83783S_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_W83783S_IN2; - node->featminnum = SENSORS_W83783S_IN2_MIN; - node->featmaxnum = SENSORS_W83783S_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_W83783S_IN3; - node->featminnum = SENSORS_W83783S_IN3_MIN; - node->featmaxnum = SENSORS_W83783S_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_W83783S_IN4; - node->featminnum = SENSORS_W83783S_IN4_MIN; - node->featmaxnum = SENSORS_W83783S_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_W83783S_IN5; - node->featminnum = SENSORS_W83783S_IN5_MIN; - node->featmaxnum = SENSORS_W83783S_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_W83783S_IN6; - node->featminnum = SENSORS_W83783S_IN6_MIN; - node->featmaxnum = SENSORS_W83783S_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_W83783S_FAN1; - node->featminnum = SENSORS_W83783S_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 9: - node->featnum = SENSORS_W83783S_FAN2; - node->featminnum = SENSORS_W83783S_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 10: - node->featnum = SENSORS_W83783S_FAN3; - node->featminnum = SENSORS_W83783S_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_W83783S_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83783S_TEMP1_OVER; - node->feattype = TEMP; - break; - case 12: - node->featnum = SENSORS_W83783S_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83783S_TEMP2_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define AS99127F_NUM_FEAT 15 - -/* Get the feature info for as99127f sensor. */ -int get_feat_info_as99127f( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_W83782D_IN0; - node->featminnum = SENSORS_W83782D_IN0_MIN; - node->featmaxnum = SENSORS_W83782D_IN0_MAX; - node->feattype = VOLT; - break; - case 2: - node->featnum = SENSORS_W83782D_IN1; - node->featminnum = SENSORS_W83782D_IN1_MIN; - node->featmaxnum = SENSORS_W83782D_IN1_MAX; - node->feattype = VOLT; - break; - case 3: - node->featnum = SENSORS_W83782D_IN2; - node->featminnum = SENSORS_W83782D_IN2_MIN; - node->featmaxnum = SENSORS_W83782D_IN2_MAX; - node->feattype = VOLT; - break; - case 4: - node->featnum = SENSORS_W83782D_IN3; - node->featminnum = SENSORS_W83782D_IN3_MIN; - node->featmaxnum = SENSORS_W83782D_IN3_MAX; - node->feattype = VOLT; - break; - case 5: - node->featnum = SENSORS_W83782D_IN4; - node->featminnum = SENSORS_W83782D_IN4_MIN; - node->featmaxnum = SENSORS_W83782D_IN4_MAX; - node->feattype = VOLT; - break; - case 6: - node->featnum = SENSORS_W83782D_IN5; - node->featminnum = SENSORS_W83782D_IN5_MIN; - node->featmaxnum = SENSORS_W83782D_IN5_MAX; - node->feattype = VOLT; - break; - case 7: - node->featnum = SENSORS_W83782D_IN6; - node->featminnum = SENSORS_W83782D_IN6_MIN; - node->featmaxnum = SENSORS_W83782D_IN6_MAX; - node->feattype = VOLT; - break; - case 8: - node->featnum = SENSORS_W83782D_IN7; - node->featminnum = SENSORS_W83782D_IN7_MIN; - node->featmaxnum = SENSORS_W83782D_IN7_MAX; - node->feattype = VOLT; - break; - case 9: - node->featnum = SENSORS_W83782D_IN8; - node->featminnum = SENSORS_W83782D_IN8_MIN; - node->featmaxnum = SENSORS_W83782D_IN8_MAX; - node->feattype = VOLT; - break; - case 10: - node->featnum = SENSORS_W83782D_FAN1; - node->featminnum = SENSORS_W83782D_FAN1_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 11: - node->featnum = SENSORS_W83782D_FAN2; - node->featminnum = SENSORS_W83782D_FAN2_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 12: - node->featnum = SENSORS_W83781D_FAN3; - node->featminnum = SENSORS_W83781D_FAN3_MIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = FAN; - break; - case 13: - node->featnum = SENSORS_W83782D_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83782D_TEMP1_OVER; - node->feattype = TEMP; - break; - case 14: - node->featnum = SENSORS_W83781D_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83782D_TEMP2_OVER; - node->feattype = TEMP; - break; - case 15: - node->featnum = SENSORS_W83782D_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = SENSORS_W83782D_TEMP3_OVER; - node->feattype = TEMP; - break; - default: - return FAILURE; - } - - return SUCCESS; -} - -#define K8TEMP_NUM_FEAT 4 - -/* Get the feature info for k8temp sensor. */ -int get_feat_info_k8temp( updates *node, sensors_chip_name name, int num ) { - switch (num) { - case 1: - node->featnum = SENSORS_K8TEMP_TEMP1; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 2: - node->featnum = SENSORS_K8TEMP_TEMP2; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 3: - node->featnum = SENSORS_K8TEMP_TEMP3; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - case 4: - node->featnum = SENSORS_K8TEMP_TEMP4; - node->featminnum = UNDEFMAXMIN; - node->featmaxnum = UNDEFMAXMIN; - node->feattype = TEMP; - break; - default: - return FAILURE; - break; - } - - return SUCCESS; -} - - -/* Simply return the number of features a specified sensor has from - * defines above. - */ -int get_num_feat( sensors_chip_name name ) { - if ( ( strcmp( name.prefix, SENSORS_ADM1021_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADM1023_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_LM84_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_GL523_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_THMC10_PREFIX ) == 0 ) ) { - return ADM1021_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_EEPROM_PREFIX ) == 0 ) { - return EEPROM_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_F71805F_PREFIX ) == 0 ) { - return F71805F_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_IT87_PREFIX ) == 0 ) { - return IT87_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_IT8712_PREFIX ) == 0 ) { - return IT87_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_LM75_PREFIX ) == 0 ) { - return LM75_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_LM78_PREFIX ) == 0 ) { - return LM78_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_LM78J_PREFIX ) == 0 ) { - return LM78J_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_LM79_PREFIX ) == 0 ) { - return LM79_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_LM80_PREFIX ) == 0 ) { - return LM80_NUM_FEAT; - } else if ( ( strcmp( name.prefix, SENSORS_LM85_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_LM85B_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_LM85C_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADM1027_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADT7463_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_EMC6D100_PREFIX ) == 0 ) ) { - return LM85_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_LM87_PREFIX ) == 0 ) { - return LM87_NUM_FEAT; - } else if ( ( strcmp( name.prefix, SENSORS_LM90_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADM1032_PREFIX ) == 0 ) ) { - return LM90_NUM_FEAT; - } else if ( ( strcmp( name.prefix, SENSORS_MAX1617_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_MC1066_PREFIX ) == 0 ) ) { - return MAX1617_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_MAX1617A_PREFIX ) == 0 ) { - return MAX1617A_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_SMSC47M1_PREFIX ) == 0 ) { - return SMSC47M1_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_SMSC47M192_PREFIX ) == 0 ) { - return SMSC47M192_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_SMSC47B397_PREFIX ) == 0 ) { - return SMSC47B397_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_VIA686A_PREFIX ) == 0 ) { - return VIA686A_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_W83781D_PREFIX ) == 0 ) { - return W83781D_NUM_FEAT; - } else if ( ( strcmp( name.prefix, SENSORS_W83782D_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83627HF_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83627THF_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83791D_PREFIX ) == 0 ) ) { - return W83782D_NUM_FEAT; - } else if ( ( strcmp( name.prefix, SENSORS_W83627EHF_PREFIX ) == 0 ) ) { - return W83627EHF_NUM_FEAT; - } else if ( ( strcmp( name.prefix, SENSORS_W83783S_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83697HF_PREFIX ) == 0 ) ) { - return W83783S_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_AS99127F_PREFIX ) == 0 ) { - return AS99127F_NUM_FEAT; - } else if ( strcmp( name.prefix, SENSORS_K8TEMP_PREFIX ) == 0 ) { - return K8TEMP_NUM_FEAT; - } else { - return 0; - } -} - /* Add a node to the feature linked list at the passed node pointer. */ -updates *add_node( updates *node, sensors_chip_name name, GtkWidget *darea, - GtkWidget *pbar, int num ) { - int retval = 0; +updates *add_node( const sensors_chip_name *name, + const sensors_feature *feature ) { + const sensors_subfeature *subfeature; + updates *node; if( ( node = g_malloc( sizeof( updates ) ) ) == NULL ) { fprintf( stderr, "malloc failed!\n" ); return NULL; } - if ( ( strcmp( name.prefix, SENSORS_ADM1021_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADM1023_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_LM84_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_GL523_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_THMC10_PREFIX ) == 0 ) ) { - retval = get_feat_info_adm1021( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_EEPROM_PREFIX ) == 0 ) { - retval = get_feat_info_eeprom( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_F71805F_PREFIX ) == 0 ) { - retval = get_feat_info_f71805f( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_IT87_PREFIX ) == 0 ) { - retval = get_feat_info_it87( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_IT8712_PREFIX ) == 0 ) { - retval = get_feat_info_it87( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_LM75_PREFIX ) == 0 ) { - retval = get_feat_info_lm75( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_LM78_PREFIX ) == 0 ) { - retval = get_feat_info_lm78( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_LM78J_PREFIX ) == 0 ) { - retval = get_feat_info_lm78j( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_LM79_PREFIX ) == 0 ) { - retval = get_feat_info_lm79( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_LM80_PREFIX ) == 0 ) { - retval = get_feat_info_lm80( node, name, num ); - } else if ( ( strcmp( name.prefix, SENSORS_LM85_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_LM85B_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_LM85C_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADM1027_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADT7463_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_EMC6D100_PREFIX ) == 0 ) ) { - retval = get_feat_info_lm85( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_LM87_PREFIX ) == 0 ) { - retval = get_feat_info_lm87( node, name, num ); - } else if ( ( strcmp( name.prefix, SENSORS_LM90_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_ADM1032_PREFIX ) == 0 ) ) { - retval = get_feat_info_lm90( node, name, num ); - } else if ( ( strcmp( name.prefix, SENSORS_MAX1617_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_MC1066_PREFIX ) == 0 ) ) { - retval = get_feat_info_max1617( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_MAX1617A_PREFIX ) == 0 ) { - retval = get_feat_info_max1617a( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_SMSC47B397_PREFIX ) == 0 ) { - retval = get_feat_info_smsc47b397( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_SMSC47M1_PREFIX ) == 0 ) { - retval = get_feat_info_smsc47m1( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_SMSC47M192_PREFIX ) == 0 ) { - retval = get_feat_info_smsc47m192( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_VIA686A_PREFIX ) == 0 ) { - retval = get_feat_info_via686a( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_W83781D_PREFIX ) == 0 ) { - retval = get_feat_info_w83781d( node, name, num ); - } else if ( ( strcmp( name.prefix, SENSORS_W83782D_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83627HF_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83627THF_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83791D_PREFIX ) == 0 ) ) { - retval = get_feat_info_w83782d( node, name, num ); - } else if ( ( strcmp( name.prefix, SENSORS_W83627EHF_PREFIX ) == 0 ) ) { - retval = get_feat_info_w83627ehf( node, name, num ); - } else if ( ( strcmp( name.prefix, SENSORS_W83783S_PREFIX ) == 0 ) || - ( strcmp( name.prefix, SENSORS_W83697HF_PREFIX ) == 0 ) ) { - retval = get_feat_info_w83783s( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_AS99127F_PREFIX ) == 0 ) { - retval = get_feat_info_as99127f( node, name, num ); - } else if ( strcmp( name.prefix, SENSORS_K8TEMP_PREFIX ) == 0 ) { - retval = get_feat_info_k8temp( node, name, num ); - } else { - g_free( node ); - return NULL; + switch ( feature->type ) { + case SENSORS_FEATURE_IN: + node->feattype = VOLT; + break; + case SENSORS_FEATURE_TEMP: + node->feattype = TEMP; + break; + case SENSORS_FEATURE_FAN: + node->feattype = FAN; + break; + default: + g_free( node ); + return NULL; + } + + node->featnum = UNDEFMAXMIN; + node->featminnum = UNDEFMAXMIN; + node->featmaxnum = UNDEFMAXMIN; + switch ( node->feattype ) { + case VOLT: + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_IN_INPUT)) ) + node->featnum = subfeature->number; + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_IN_MIN)) ) + node->featminnum = subfeature->number; + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_IN_MAX)) ) + node->featmaxnum = subfeature->number; + break; + case TEMP: + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_TEMP_INPUT)) ) + node->featnum = subfeature->number; + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_TEMP_MIN)) ) + node->featminnum = subfeature->number; + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_TEMP_MAX)) ) + node->featmaxnum = subfeature->number; + break; + case FAN: + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_FAN_INPUT)) ) + node->featnum = subfeature->number; + if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_FAN_MIN)) ) + node->featminnum = subfeature->number; + break; + } + + if ( node->featnum == UNDEFMAXMIN ) { + g_free( node ); + return NULL; } node->name = name; - node->darea = darea; - node->pbar = pbar; node->next = NULL; return node;