Download: xsensors-0.60-libsensors-3.patch

File xsensors-0.60-libsensors-3.patch, 88.7 KB (added by khali, 10 months ago)

libsensors 3 support for xsensors

  • xsensors-0.60

    old new  
    2525#include <unistd.h> 
    2626#include <errno.h> 
    2727#include <sensors/sensors.h> 
    28 #include <sensors/chips.h> 
    2928#include <glib.h> 
    3029#include <gtk/gtk.h> 
    3130#include "chips.h" 
    3231#include "gui.h" 
    3332 
    3433/* Version Number */ 
    35 #define VERSION "0.60" 
    36  
    37 /* Default lm_sensors config file */ 
    38 #define DEFAULT_SENS_CONF "/etc/sensors.conf" 
     34#define VERSION "lib3" 
    3935 
    4036/* Pretty identifiers. */ 
    4137enum { SUCCESS, FAILURE }; 
    4238 
    4339/* Prototypes */ 
    4440int help_msg( void ); 
    45 int print_features( sensors_chip_name ); 
  • configure.in

    old new  
    1717AC_CHECK_LIB(sensors, sensors_init,[], 
    1818        AC_MSG_ERROR(You need the sensors library)) 
    1919 
    20 AC_CHECK_HEADERS([sensors/sensors.h sensors/chips.h sensors/error.h]) 
     20AC_CHECK_HEADERS([sensors/sensors.h sensors/error.h]) 
    2121 
    2222AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([ 
    2323*** GLib 2.0 is required to build xsensors; please make sure you have the GLib 
  • xsensors-0.60

    old new  
    2424 * features vary. 
    2525 */ 
    2626typedef struct _updates { 
    27     sensors_chip_name name; 
     27    const sensors_chip_name *name; 
    2828    GtkWidget *pbar; 
    2929    GtkWidget *darea; 
    3030    int featnum; 
     
    3838} updates; 
    3939 
    4040/* Add a node to the sensor's features linked list. */ 
    41 updates *add_node( updates *, sensors_chip_name, GtkWidget *, GtkWidget *,  
    42                    int ); 
    43  
    44 /* Get the number of features of a given sensor. */ 
    45 int get_num_feat( sensors_chip_name ); 
    46  
    47 /* Feature Info Prototypes */ 
    48 int get_feat_info_adm1021( updates *node, sensors_chip_name name, int num ); 
    49 int get_feat_info_eeprom( updates *node, sensors_chip_name name, int num ); 
    50 int get_feat_info_f71805f( updates *node, sensors_chip_name name, int num ); 
    51 int get_feat_info_it87( updates *node, sensors_chip_name name, int num ); 
    52 int get_feat_info_lm75( updates *node, sensors_chip_name name, int num ); 
    53 int get_feat_info_lm78( updates *node, sensors_chip_name name, int num ); 
    54 int get_feat_info_lm78j( updates *node, sensors_chip_name name, int num ); 
    55 int get_feat_info_lm79( updates *node, sensors_chip_name name, int num ); 
    56 int get_feat_info_lm80( updates *node, sensors_chip_name name, int num ); 
    57 int get_feat_info_lm85( updates *node, sensors_chip_name name, int num ); 
    58 int get_feat_info_lm87( updates *node, sensors_chip_name name, int num ); 
    59 int get_feat_info_lm90( updates *node, sensors_chip_name name, int num ); 
    60 int get_feat_info_max1617( updates *node, sensors_chip_name name, int num ); 
    61 int get_feat_info_max1617a( updates *node, sensors_chip_name name, int num ); 
    62 int get_feat_info_smsc47m1( updates *node, sensors_chip_name name, int num ); 
    63 int get_feat_info_smsc47m192( updates *node, sensors_chip_name name, int num ); 
    64 int get_feat_info_smsc47b397( updates *node, sensors_chip_name name, int num ); 
    65 int get_feat_info_via686a( updates *node, sensors_chip_name name, int num ); 
    66 int get_feat_info_w83781d( updates *node, sensors_chip_name name, int num ); 
    67 int get_feat_info_w83782d( updates *node, sensors_chip_name name, int num ); 
    68 int get_feat_info_w83627ehf( updates *node, sensors_chip_name name, int num ); 
    69 int get_feat_info_w83783s( updates *node, sensors_chip_name name, int num ); 
    70 int get_feat_info_as99127f( updates *node, sensors_chip_name name, int num ); 
    71 int get_feat_info_k8temp( updates *node, sensors_chip_name name, int num ); 
     41updates *add_node( const sensors_chip_name *, const sensors_feature * ); 
  • xsensors-0.60

    old new  
    2222#include <math.h> 
    2323#include <gdk/gdk.h> 
    2424 
    25 enum { VOLT, TEMP, FAN, EEPROM }; 
     25enum { VOLT, TEMP, FAN }; 
    2626 
    2727#define NA "Not Available!" 
    2828 
     
    3434gint free_llist( updates * ); 
    3535gint update_sensor_data( gpointer ); 
    3636gint start_timer( GtkWidget *, gpointer ); 
    37 updates *add_sensor_tab( GtkWidget *, sensors_chip_name ); 
     37updates *add_sensor_tab( GtkWidget *, const sensors_chip_name * ); 
    3838int start_gui( int, char ** ); 
  • xsensors-0.60

    old new  
    109109 
    110110    gint result = 0; 
    111111 
    112     double a, b, c, d, tempD; 
    113  
    114112#ifdef DEBUG_XSENSORS 
    115113    printf( "area.width = %d, area.height = %d\n", event->area.width, 
    116114            event->area.height ); 
     
    309307 
    310308 
    311309            break; 
    312         case EEPROM: 
    313             result = (int) current->curvalue; 
    314  
    315             /* Special case for know EEPROM types. */ 
    316             if ( current->featnum == SENSORS_EEPROM_TYPE ) { 
    317                 if ( current->curvalue == 4 ) { 
    318                     gdk_draw_drawable( widget->window, 
    319                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    320                                      (widget) ], theme, 118, 120, 
    321                                      0, 0, 98, 30 ); 
    322                     gdk_draw_drawable( widget->window, 
    323                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    324                                      (widget) ], theme, 54, 150, 
    325                                      98, 0, 75, 30 ); 
    326                 } else if ( current->curvalue == 7 ) { 
    327                     gdk_draw_drawable( widget->window, 
    328                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    329                                      (widget) ], theme, 55, 120, 
    330                                      0, 0, 161, 30 ); 
    331                     gdk_draw_drawable( widget->window, 
    332                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    333                                      (widget) ], theme, 54, 150, 
    334                                      161, 0, 75, 30 ); 
    335                 } else if ( current->curvalue == 8 ) { 
    336                     gdk_draw_drawable( widget->window, 
    337                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    338                                      (widget) ], theme, 55, 120, 
    339                                      0, 0, 57, 30 ); 
    340                     gdk_draw_drawable( widget->window, 
    341                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    342                                      (widget) ], theme, 36, 0, 
    343                                      57, 0, 18, 30 ); 
    344                     gdk_draw_drawable( widget->window, 
    345                                      widget->style->fg_gc[ GTK_WIDGET_STATE 
    346                                      (widget) ], theme, 112, 120, 
    347                                      75, 0, 104, 30 ); 
    348                 } else { 
    349                     gdk_draw_drawable( widget->window,  
    350                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    351                                      (widget) ], theme, 198, highLow,  
    352                                      18, 0, 18, 30 ); 
    353                  
    354                     gdk_draw_drawable( widget->window,  
    355                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    356                                      (widget) ], theme, 198, highLow,  
    357                                      36, 0, 18, 30 ); 
    358                  
    359                     gdk_draw_drawable( widget->window,  
    360                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    361                                      (widget) ], theme, 198, highLow,  
    362                                      54, 0, 18, 30 ); 
    363                  
    364                     if ( result >= 100 ) { 
    365                         curInt = result / 100; 
    366                         result = result % 100; 
    367              
    368                         get_pm_location( curInt, &x ); 
    369                     } else { 
    370                         x = 198; 
    371                     } 
    372              
    373                     gdk_draw_drawable( widget->window,  
    374                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    375                                      (widget) ], theme, x, highLow,  
    376                                      72, 0, 18, 30 ); 
    377  
    378                     if ( result >= 10 ) { 
    379                         curInt = result / 10; 
    380                         result = result % 10; 
    381              
    382                         get_pm_location( curInt, &x ); 
    383                     } else { 
    384                         x = 198; 
    385                     } 
    386              
    387                     gdk_draw_drawable( widget->window,  
    388                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    389                                      (widget) ], theme, x, highLow,  
    390                                      90, 0, 18, 30 ); 
    391      
    392                     curInt = result; 
    393              
    394                     get_pm_location( curInt, &x ); 
    395                     gdk_draw_drawable( widget->window,  
    396                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    397                                      (widget) ], theme, x, highLow,  
    398                                      108, 0, 18, 30 ); 
    399  
    400                     gdk_draw_drawable( widget->window,  
    401                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    402                                      (widget) ], theme, 198, highLow,  
    403                                      126, 0, 18, 30 ); 
    404                  
    405                     gdk_draw_drawable( widget->window,  
    406                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    407                                      (widget) ], theme, 198, highLow,  
    408                                      144, 0, 18, 30 ); 
    409                  
    410                     gdk_draw_drawable( widget->window,  
    411                                      widget->style->fg_gc[ GTK_WIDGET_STATE  
    412                                      (widget) ], theme, 198, highLow,  
    413                                      162, 0, 18, 30 ); 
    414                  
    415                 } 
    416             } else { 
    417                 sensors_get_feature( current->name, SENSORS_EEPROM_TYPE,  
    418                                      &tempD ); 
    419                 if ( tempD == 4.0 || tempD == 7.0 || tempD == 8.0 ) { 
    420                     sensors_get_feature(current->name, SENSORS_EEPROM_ROWADDR,  
    421                                         &a); 
    422                     sensors_get_feature(current->name, SENSORS_EEPROM_COLADDR,  
    423                                         &b); 
    424                     sensors_get_feature(current->name, SENSORS_EEPROM_NUMROWS,  
    425                                         &c); 
    426                     sensors_get_feature(current->name, SENSORS_EEPROM_BANKS,  
    427                                         &d); 
    428                     result = (((int) a) & 0x0f) + (((int) b) & 0x0f) - 17; 
    429  
    430                     if ( tempD == 8.0 ) { /* DDR2 */ 
    431                         result = (1 << result) * ((((int) c) & 0x07) + 1) 
    432                                  * ((int) d); 
    433  
    434                     } else if ( result > 0 && result <= 12 && c <= 8 && d <= 8 ) 
    435                     { 
    436                         result = (1 << result) * ((int) c) * ((int) d); 
    437                     } 
    438                 } 
    439             
    440                 gdk_draw_drawable( widget->window,  
    441                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    442                                  (widget) ], theme, 198, highLow,  
    443                                  18, 0, 18, 30 ); 
    444                  
    445                 gdk_draw_drawable( widget->window,  
    446                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    447                                  (widget) ], theme, 198, highLow,  
    448                                  36, 0, 18, 30 ); 
    449   
    450                 if ( result >= 1000 ) { 
    451                     curInt = result / 1000; 
    452                     result = result % 1000; 
    453              
    454                     get_pm_location( curInt, &x ); 
    455                 } else { 
    456                     x = 198; 
    457                 } 
    458                     
    459                 gdk_draw_drawable( widget->window,  
    460                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    461                                  (widget) ], theme, x, highLow,  
    462                                  54, 0, 18, 30 ); 
    463                      
    464                 if ( result >= 100 || x != 198 ) { 
    465                     curInt = result / 100; 
    466                     result = result % 100; 
    467              
    468                     get_pm_location( curInt, &x ); 
    469                 } 
    470              
    471                 gdk_draw_drawable( widget->window,  
    472                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    473                                  (widget) ], theme, x, highLow,  
    474                                  72, 0, 18, 30 ); 
    475  
    476                 if ( result >= 10 || x != 198 ) { 
    477                     curInt = result / 10; 
    478                     result = result % 10; 
    479              
    480                     get_pm_location( curInt, &x ); 
    481                 } 
    482              
    483                 gdk_draw_drawable( widget->window,  
    484                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    485                                  (widget) ], theme, x, highLow,  
    486                                  90, 0, 18, 30 ); 
    487  
    488                 curInt = result; 
    489              
    490                 get_pm_location( curInt, &x ); 
    491                 gdk_draw_drawable( widget->window,  
    492                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    493                                  (widget) ], theme, x, highLow,  
    494                                  108, 0, 18, 30 ); 
    495  
    496                 gdk_draw_drawable( widget->window,  
    497                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    498                                  (widget) ], theme, 198, highLow,  
    499                                  126, 0, 18, 30 ); 
    500                      
    501                 gdk_draw_drawable( widget->window,  
    502                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    503                                  (widget) ], theme, 198, highLow,  
    504                                  144, 0, 18, 30 ); 
    505                      
    506                 gdk_draw_drawable( widget->window,  
    507                                  widget->style->fg_gc[ GTK_WIDGET_STATE  
    508                                  (widget) ], theme, 198, highLow,  
    509                                  162, 0, 18, 30 ); 
    510                      
    511             } 
    512  
    513             break; 
    514310        default: 
    515311            break; 
    516312    } 
     
    536332    gfloat percent = 0; 
    537333 
    538334    do { 
    539         if ( sensors_get_feature( updata->name, updata->featnum, 
     335        if ( sensors_get_value( updata->name, updata->featnum, 
    540336             &(updata->curvalue) ) != 0 ) { 
    541337                updata->curvalue = 0; 
    542338        } 
    543339         
    544340        if ( updata->featminnum != UNDEFMAXMIN ) { 
    545             sensors_get_feature( updata->name, updata->featminnum,  
    546                                  &(updata->curmin) ); 
     341            sensors_get_value( updata->name, updata->featminnum, 
     342                               &(updata->curmin) ); 
    547343        } else { 
    548344            updata->curmin = 0; 
    549345        } 
    550346 
    551347        if ( updata->featmaxnum != UNDEFMAXMIN ) { 
    552             sensors_get_feature( updata->name, updata->featmaxnum,  
    553                                  &(updata->curmax) ); 
     348            sensors_get_value( updata->name, updata->featmaxnum, 
     349                               &(updata->curmax) ); 
    554350        } else { 
    555351            updata->curmax = 10000; 
    556352        } 
    557353 
    558         if ( updata->feattype != EEPROM ) { 
    559             if (updata->curmax != updata->curmin ) { 
    560                 percent = ( ( updata->curvalue - updata->curmin ) / 
    561                             ( updata->curmax - updata->curmin ) ); 
    562             } else { 
    563                 percent = 0.0; 
    564             } 
     354        if (updata->curmax != updata->curmin ) { 
     355            percent = ( ( updata->curvalue - updata->curmin ) / 
     356                        ( updata->curmax - updata->curmin ) ); 
     357        } else { 
     358            percent = 0.0; 
     359        } 
    565360#ifdef DEBUG_XSENSORS 
    566             printf( "curvalue = %f, curmax = %f, curmin = %f, percent = %f\n",  
    567                     updata->curvalue, updata->curmax, updata->curmin, percent ); 
     361        printf( "curvalue = %f, curmax = %f, curmin = %f, percent = %f\n", 
     362                updata->curvalue, updata->curmax, updata->curmin, percent ); 
    568363#endif 
    569          
    570             if ( percent < 0 ) 
    571                 percent = 0; 
    572364 
    573             if ( percent > 1 ) 
    574                 percent = 1; 
     365        if ( percent < 0 ) 
     366            percent = 0; 
    575367 
    576             gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR (updata->pbar),  
    577                                            percent ); 
    578         } 
     368        if ( percent > 1 ) 
     369            percent = 1; 
     370 
     371        gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR (updata->pbar), 
     372                                       percent ); 
    579373 
    580374        gtk_widget_queue_draw_area( updata->darea, 0, 0, 153, 30 ); 
    581375 
     
    602396    return SUCCESS; 
    603397} 
    604398 
    605 updates *add_sensor_tab( GtkWidget *container, sensors_chip_name name ) { 
     399updates *add_sensor_tab( GtkWidget *container, const sensors_chip_name *name ) { 
    606400    /* packing boxes */ 
    607401    GtkWidget *mainbox = NULL; 
    608402    GtkWidget *voltbox = NULL; 
    609403    GtkWidget *tempbox = NULL; 
    610404    GtkWidget *fanbox = NULL; 
    611     GtkWidget *eeprombox = NULL; 
    612405    GtkWidget *currbox = NULL; 
    613406    GtkWidget *innerbox = NULL; 
    614407    
     
    620413    GtkWidget *voltlabel = NULL; 
    621414    GtkWidget *templabel = NULL; 
    622415    GtkWidget *fanlabel = NULL; 
    623     GtkWidget *eepromlabel = NULL; 
    624416 
    625417    /* feature data */ 
    626418    updates *head = NULL; 
    627419    updates *current = NULL, *prev = NULL; 
    628420 
     421    const sensors_feature *feature; 
     422 
    629423    /* several needed ints */ 
    630     int numfeat = 0; 
    631424    int i = 0; 
    632425    int usedvolt = 0; 
    633426    int usedtemp = 0; 
    634427    int usedfan = 0; 
    635     int usedeeprom = 0; 
    636     int valid = 0; 
    637428     
    638     double value = 0; 
    639     
    640429    /* fields placed in the notebook to display feature info */ 
    641430    GtkWidget *darea = NULL; 
    642431    char *feattext = NULL; 
     
    650439    voltbox = gtk_vbox_new( FALSE, 0 ); 
    651440    tempbox = gtk_vbox_new( FALSE, 0 ); 
    652441    fanbox = gtk_vbox_new( FALSE, 0 ); 
    653     eeprombox = gtk_vbox_new( FALSE, 0 ); 
    654442 
    655443    /* Create notebook for sensors. */ 
    656444    noteframe = gtk_frame_new( NULL ); 
    657445    gtk_container_set_border_width( GTK_CONTAINER (noteframe), 10 ); 
    658446    gtk_widget_show( noteframe ); 
    659447     
    660     notelabel = gtk_label_new( name.prefix ); 
     448    notelabel = gtk_label_new( name->prefix ); 
    661449    gtk_widget_show( notelabel ); 
    662450 
    663451    gtk_container_add( GTK_CONTAINER (noteframe), mainbox ); 
     
    667455    voltlabel = gtk_label_new( "Voltages:" ); 
    668456    templabel = gtk_label_new( "Temperatures:" ); 
    669457    fanlabel = gtk_label_new( "Fans:" ); 
    670     eepromlabel = gtk_label_new( "EEPROM:" ); 
    671458    gtk_box_pack_start( GTK_BOX (voltbox), voltlabel, FALSE, FALSE, 0 ); 
    672459    gtk_box_pack_start( GTK_BOX (tempbox), templabel, FALSE, FALSE, 0 ); 
    673460    gtk_box_pack_start( GTK_BOX (fanbox), fanlabel, FALSE, FALSE, 0 ); 
    674     gtk_box_pack_start( GTK_BOX (eeprombox), eepromlabel, FALSE, FALSE, 0 ); 
    675461 
    676462    /* Create labels and entry fields for features. */ 
    677     numfeat = get_num_feat( name ); 
    678     for ( i = 1; i <= numfeat; i++ ) { 
     463    while ( (feature = sensors_get_features( name, &i )) ) { 
     464            updates *new_node = add_node( name, feature ); 
     465            if ( new_node == NULL ) 
     466                continue; 
     467 
    679468            featframe = gtk_frame_new( NULL ); 
    680469            innerbox = gtk_vbox_new( FALSE, 0 ); 
    681470            featpbar = gtk_progress_bar_new(); 
     
    683472            gtk_widget_modify_bg( darea, GTK_STATE_NORMAL, &colorWhite ); 
    684473            gtk_widget_set_size_request( darea, 36, 30 ); 
    685474             
     475            new_node->darea = darea; 
     476            new_node->pbar = featpbar; 
     477 
    686478            if ( head == NULL ) { 
    687479                prev = head; 
    688                 head = current = add_node( head, name, darea, featpbar, i ); 
     480                head = current = new_node; 
    689481            } else { 
    690482                prev = current; 
    691                 current = current->next =  
    692                     add_node( current->next, name, darea, featpbar, i ); 
    693             } 
    694  
    695             if ( current->featnum == SENSORS_EEPROM_TYPE ) 
    696                 gtk_widget_set_size_request( darea, 236, 30 ); 
    697  
    698             if ( sensors_get_ignored( current->name, current->featnum ) == 0 ) { 
    699                 if ( prev == NULL ) { 
    700                     head = NULL; 
    701                 } else { 
    702                     prev->next = current->next; 
    703                 } 
    704                 g_free( current ); 
    705                 current = prev; 
    706                 continue; 
     483                current = current->next = new_node; 
    707484            } 
    708485 
    709486            /* Connect the expose event sinal handler to redraw the numbers. */ 
    710487            g_signal_connect( G_OBJECT(darea), "expose_event",  
    711488                              G_CALLBACK(expose_event_callback), current ); 
    712489             
    713             sensors_get_label( name, current->featnum, &feattext); 
     490            feattext = sensors_get_label( name, feature ); 
    714491             
    715             valid=(sensors_get_feature( name, current->featnum, &value))?0:1; 
    716              
    717             if ( ( feattext != NULL ) && (valid) ) { 
     492            if ( feattext != NULL ) { 
    718493#ifdef DEBUG_XSENSORS 
    719494                printf( "Adding feature %d, %s.\n", i, feattext ); 
    720495#endif 
     
    744519                        currbox = fanbox; 
    745520                        usedfan++; 
    746521                        break; 
    747                     case EEPROM: 
    748                         currbox = eeprombox; 
    749                         usedeeprom++; 
    750                         break; 
    751522                    default: 
    752523                        fprintf( stderr,  
    753524                                 "Type not recognized, not packing.\n" ); 
     
    759530                gtk_box_pack_start( GTK_BOX (innerbox), darea,  
    760531                                    FALSE, FALSE, 0 ); 
    761532                 
    762                 if ( current->feattype != EEPROM ) 
    763                     gtk_box_pack_start( GTK_BOX (innerbox), featpbar,  
    764                                         FALSE, FALSE, 0 ); 
     533                gtk_box_pack_start( GTK_BOX (innerbox), featpbar, 
     534                                    FALSE, FALSE, 0 ); 
    765535 
    766536            } else { 
    767537                gtk_frame_set_label( GTK_FRAME (featframe), feattext ); 
     
    769539            gtk_widget_show( featframe ); 
    770540            gtk_widget_show( innerbox ); 
    771541            gtk_widget_show( darea ); 
    772             if ( current->feattype != EEPROM ) 
    773                 gtk_widget_show( featpbar ); 
     542            gtk_widget_show( featpbar ); 
    774543            g_free( feattext ); 
    775544            feattext = NULL; 
    776545    } 
     
    793562        gtk_widget_show( fanlabel ); 
    794563    } 
    795564 
    796     if ( usedeeprom > 0 ) { 
    797         gtk_widget_show( eeprombox ); 
    798         gtk_box_pack_start( GTK_BOX (mainbox), eeprombox, FALSE, FALSE, 0 ); 
    799         gtk_widget_show( eepromlabel ); 
    800     } 
    801  
    802565    g_free( feattext ); 
    803566 
    804567    return head; 
     
    879642 
    880643    gtk_container_add( GTK_CONTAINER (mainwindow), notebook ); 
    881644 
    882     while ( ( name = sensors_get_detected_chips( &chipnum ) ) != NULL ) { 
    883         if ( get_num_feat( *name ) > 0 ) { 
     645    while ( ( name = sensors_get_detected_chips( NULL, &chipnum ) ) != NULL ) { 
     646        if ( 1 ) { 
    884647#ifdef DEBUG_XSENSORS 
    885648            printf( "Adding tab for %s\n", name->prefix ); 
    886649#endif 
    887             if ( ( head = add_sensor_tab( notebook, *name ) ) == NULL ) 
     650            if ( ( head = add_sensor_tab( notebook, name ) ) == NULL ) 
    888651                return FAILURE; 
    889652             
    890653            update_sensor_data( head ); 
    891654            g_signal_connect( G_OBJECT (mainwindow), "realize", 
    892655                              G_CALLBACK (start_timer), head ); 
    893         } else { 
    894             fprintf( stderr, "Sensor '%s' not supported by xsensors!\n",  
    895                      name->prefix ); 
    896656        } 
    897657    } 
    898658     
  • xsensors-0.60

    old new  
    4444            "--------\n\n" 
    4545            "-f\t\tDisplay all temperatures in Fahrenheit.\n" 
    4646            "-h\t\tDisplay this help text and exit.\n" 
    47             "-c filename\tSpecify the lm_sensors configuration file.\n" 
     47            "-c filename\tSpecify the libsensors configuration file.\n" 
    4848            "-i filename\tSpecify the image file to use as a theme.\n" 
    4949            "-t time\t\tSpecify the update time in number of seconds.\n" 
    5050            "\t\tSet this to a negative number for no update.\n" 
     
    5555    return SUCCESS; 
    5656} 
    5757 
    58 /* Prints out the chips' labels and features. Mainly used for debugging. */ 
    59 #ifdef DEBUG_XSENSORS 
    60 int print_features( sensors_chip_name name ) { 
    61     int featnum = 1; 
    62     char *labelresult = NULL; 
    63     double featureresult = 0; 
    64  
    65     printf( "Sensor: %s\n", name.prefix ); 
    66  
    67     /* Aparently none of the features are defined over 99 so go through all 
    68      * up until that and list those that return successfully. 
    69      */ 
    70     while ( featnum < 99 ) { 
    71  
    72         if ( sensors_get_label( name, featnum, &labelresult ) == 0 ) { 
    73             if ( sensors_get_feature( name, featnum, &featureresult ) != 0 ) { 
    74                 fprintf( stderr, "Could not get feature!\n" ); 
    75                 return FAILURE; 
    76             } 
    77         } 
    78         
    79         if ( labelresult != NULL ) { 
    80             printf( "%s: %f\n", labelresult, featureresult ); 
    81         } 
    82  
    83         featnum++; 
    84     } 
    85  
    86     free( labelresult ); 
    87  
    88     return SUCCESS; 
    89 } 
    90 #endif /* DEBUG_XSENSORS */ 
    91  
    9258/* Main. */ 
    9359int main( int argc, char **argv ) { 
    9460    int c = 0; 
     
    139105        } 
    140106    } 
    141107 
    142     /* If lm_sensors config file was not specified, use default. */ 
    143     if ( sens_config == NULL ) 
    144         sens_config = strdup( DEFAULT_SENS_CONF ); 
    145  
    146     /* Open the config file. */     
    147     if ( ( sens_conf_file = fopen( sens_config, "r" ) ) == NULL ) { 
     108    /* Open the config file if specified. */ 
     109    if ( sens_config && 
     110        ( sens_conf_file = fopen( sens_config, "r" ) ) == NULL ) { 
    148111        fprintf( stderr, "Error opening config file: %s\n" 
    149                  "Use -c option to specify location of lm_sensors" 
    150                  " configuration file.\n" 
    151112                 , sens_config ); 
    152113        return EXIT_FAILURE; 
    153114    } 
     
    168129    /* Clean up the sensors library. */ 
    169130    sensors_cleanup(); 
    170131     
    171     free( sens_config ); 
     132    if ( sens_config != NULL ) 
     133        free( sens_config ); 
    172134    if ( imagefile != NULL ) 
    173135        free( imagefile ); 
    174136 
    175137    /* Close the config file. */ 
    176     if ( fclose( sens_conf_file ) != SUCCESS ) { 
     138    if ( sens_conf_file && fclose( sens_conf_file ) != SUCCESS ) { 
    177139        fprintf( stderr,  
    178140                 "Something has gone wrong closing the config file!\n" ); 
    179141        return EXIT_FAILURE; 
  • xsensors-0.60

    old new  
    2020 
    2121#include "main.h" 
    2222 
    23 #define ADM1021_NUM_FEAT 2 
    24  
    25 /* Get the feature info for adm1021 sensor. */ 
    26 int get_feat_info_adm1021( updates *node, sensors_chip_name name, int num ) { 
    27     switch (num) { 
    28         case 1: 
    29             node->featnum = SENSORS_ADM1021_TEMP; 
    30             node->featminnum = UNDEFMAXMIN; 
    31             node->featmaxnum = SENSORS_ADM1021_TEMP_OVER; 
    32             node->feattype = TEMP; 
    33             break; 
    34         case 2: 
    35             node->featnum = SENSORS_ADM1021_REMOTE_TEMP; 
    36             node->featminnum = UNDEFMAXMIN; 
    37             node->featmaxnum = SENSORS_ADM1021_REMOTE_TEMP_OVER; 
    38             node->feattype = TEMP; 
    39             break; 
    40         default: 
    41             return FAILURE; 
    42     } 
    43   
    44     return SUCCESS; 
    45 } 
    46  
    47 #define EEPROM_NUM_FEAT 2   /* Was 5, see comment below. */ 
    48  
    49 /* Get the feature info for eeprom. */ 
    50 int get_feat_info_eeprom( updates *node, sensors_chip_name name, int num ) { 
    51     switch (num) { 
    52         case 1: 
    53             node->featnum = SENSORS_EEPROM_TYPE; 
    54             node->featminnum = UNDEFMAXMIN; 
    55             node->featmaxnum = UNDEFMAXMIN; 
    56             node->feattype = EEPROM; 
    57             break; 
    58         case 2: 
    59             node->featnum = SENSORS_EEPROM_ROWADDR; 
    60             node->featminnum = UNDEFMAXMIN; 
    61             node->featmaxnum = UNDEFMAXMIN; 
    62             node->feattype = EEPROM; 
    63             break; 
    64 #if 0 /* Removed so that we can now compute the memory size. */ 
    65         case 3: 
    66             node->featnum = SENSORS_EEPROM_COLADDR; 
    67             node->featminnum = UNDEFMAXMIN; 
    68             node->featmaxnum = UNDEFMAXMIN; 
    69             node->feattype = EEPROM; 
    70             break; 
    71         case 4: 
    72             node->featnum = SENSORS_EEPROM_NUMROWS; 
    73             node->featminnum = UNDEFMAXMIN; 
    74             node->featmaxnum = UNDEFMAXMIN; 
    75             node->feattype = EEPROM; 
    76             break; 
    77         case 5: 
    78             node->featnum = SENSORS_EEPROM_BANKS; 
    79             node->featminnum = UNDEFMAXMIN; 
    80             node->featmaxnum = UNDEFMAXMIN; 
    81             node->feattype = EEPROM; 
    82             break; 
    83 #endif 
    84         default: 
    85             return FAILURE; 
    86     } 
    87   
    88     return SUCCESS; 
    89 } 
    90  
    91 #define F71805F_NUM_FEAT 15 
    92  
    93 int get_feat_info_f71805f( updates *node, sensors_chip_name name, int num ) { 
    94     switch (num) { 
    95         case 1: 
    96         case 2: 
    97         case 3: 
    98         case 4: 
    99         case 5: 
    100         case 6: 
    101         case 7: 
    102         case 8: 
    103         case 9: 
    104             node->featnum = SENSORS_F71805F_IN(num - 1); 
    105             node->featminnum = SENSORS_F71805F_IN_MIN(num - 1); 
    106             node->featmaxnum = SENSORS_F71805F_IN_MAX(num - 1); 
    107             node->feattype = VOLT; 
    108             break; 
    109         case 10: 
    110         case 11: 
    111         case 12: 
    112             node->featnum = SENSORS_F71805F_FAN(num - 9); 
    113             node->featminnum = SENSORS_F71805F_FAN_MIN(num - 9); 
    114             node->featmaxnum = UNDEFMAXMIN; 
    115             node->feattype = FAN; 
    116             break; 
    117         case 13: 
    118         case 14: 
    119         case 15: 
    120             node->featnum = SENSORS_F71805F_TEMP(num - 12); 
    121             node->featminnum = UNDEFMAXMIN; 
    122             node->featmaxnum = SENSORS_F71805F_TEMP_MAX(num - 12); 
    123             node->feattype = TEMP; 
    124             break; 
    125         default: 
    126             return FAILURE; 
    127     } 
    128  
    129     return SUCCESS; 
    130 } 
    131  
    132 #define IT87_NUM_FEAT 15 
    133  
    134 /* Get the feature info for lm87 sensor. */ 
    135 int get_feat_info_it87( updates *node, sensors_chip_name name, int num ) { 
    136     switch (num) { 
    137         case 1: 
    138             node->featnum = SENSORS_IT87_IN0; 
    139             node->featminnum = SENSORS_IT87_IN0_MIN; 
    140             node->featmaxnum = SENSORS_IT87_IN0_MAX; 
    141             node->feattype = VOLT; 
    142             break; 
    143         case 2: 
    144             node->featnum = SENSORS_IT87_IN1; 
    145             node->featminnum = SENSORS_IT87_IN1_MIN; 
    146             node->featmaxnum = SENSORS_IT87_IN1_MAX; 
    147             node->feattype = VOLT; 
    148             break; 
    149         case 3: 
    150             node->featnum = SENSORS_IT87_IN2; 
    151             node->featminnum = SENSORS_IT87_IN2_MIN; 
    152             node->featmaxnum = SENSORS_IT87_IN2_MAX; 
    153             node->feattype = VOLT; 
    154             break; 
    155         case 4: 
    156             node->featnum = SENSORS_IT87_IN3; 
    157             node->featminnum = SENSORS_IT87_IN3_MIN; 
    158             node->featmaxnum = SENSORS_IT87_IN3_MAX; 
    159             node->feattype = VOLT; 
    160             break; 
    161         case 5: 
    162             node->featnum = SENSORS_IT87_IN4; 
    163             node->featminnum = SENSORS_IT87_IN4_MIN; 
    164             node->featmaxnum = SENSORS_IT87_IN4_MAX; 
    165             node->feattype = VOLT; 
    166             break; 
    167         case 6: 
    168             node->featnum = SENSORS_IT87_IN5; 
    169             node->featminnum = SENSORS_IT87_IN5_MIN; 
    170             node->featmaxnum = SENSORS_IT87_IN5_MAX; 
    171             node->feattype = VOLT; 
    172             break; 
    173         case 7: 
    174             node->featnum = SENSORS_IT87_IN6; 
    175             node->featminnum = SENSORS_IT87_IN6_MIN; 
    176             node->featmaxnum = SENSORS_IT87_IN6_MAX; 
    177             node->feattype = VOLT; 
    178             break; 
    179         case 8: 
    180             node->featnum = SENSORS_IT87_IN7; 
    181             node->featminnum = SENSORS_IT87_IN7_MIN; 
    182             node->featmaxnum = SENSORS_IT87_IN7_MAX; 
    183             node->feattype = VOLT; 
    184             break; 
    185         case 9: 
    186             node->featnum = SENSORS_IT87_IN8; 
    187             node->featminnum = UNDEFMAXMIN; 
    188             node->featmaxnum = UNDEFMAXMIN; 
    189             node->feattype = VOLT; 
    190             break; 
    191         case 10: 
    192             node->featnum = SENSORS_IT87_FAN1; 
    193             node->featminnum = SENSORS_IT87_FAN1_MIN; 
    194             node->featmaxnum = UNDEFMAXMIN; 
    195             node->feattype = FAN; 
    196             break; 
    197         case 11: 
    198             node->featnum = SENSORS_IT87_FAN2; 
    199             node->featminnum = SENSORS_IT87_FAN2_MIN; 
    200             node->featmaxnum = UNDEFMAXMIN; 
    201             node->feattype = FAN; 
    202             break; 
    203         case 12: 
    204             node->featnum = SENSORS_IT87_FAN3; 
    205             node->featminnum = SENSORS_IT87_FAN3_MIN; 
    206             node->featmaxnum = UNDEFMAXMIN; 
    207             node->feattype = FAN; 
    208             break; 
    209         case 13: 
    210             node->featnum = SENSORS_IT87_TEMP1; 
    211             node->featminnum = UNDEFMAXMIN; 
    212             node->featmaxnum = SENSORS_IT87_TEMP1_HIGH; 
    213             node->feattype = TEMP; 
    214             break; 
    215         case 14: 
    216             node->featnum = SENSORS_IT87_TEMP2; 
    217             node->featminnum = UNDEFMAXMIN; 
    218             node->featmaxnum = SENSORS_IT87_TEMP2_HIGH; 
    219             node->feattype = TEMP; 
    220             break; 
    221         case 15: 
    222             node->featnum = SENSORS_IT87_TEMP3; 
    223             node->featminnum = UNDEFMAXMIN; 
    224             node->featmaxnum = SENSORS_IT87_TEMP3_HIGH; 
    225             node->feattype = TEMP; 
    226             break; 
    227         default: 
    228             return FAILURE; 
    229     } 
    230  
    231     return SUCCESS; 
    232 } 
    233  
    234 #define LM75_NUM_FEAT 1 
    235  
    236 /* Get the feature info for lm75 sensor. */ 
    237 int get_feat_info_lm75( updates *node, sensors_chip_name name, int num ) { 
    238     switch (num) { 
    239         case 1: 
    240             node->featnum = SENSORS_LM75_TEMP; 
    241             node->featminnum = UNDEFMAXMIN; 
    242             node->featmaxnum = SENSORS_LM75_TEMP_OVER; 
    243             node->feattype = TEMP; 
    244             break; 
    245         default: 
    246             return FAILURE; 
    247     } 
    248  
    249     return SUCCESS; 
    250 } 
    251  
    252 #define LM78_NUM_FEAT 11 
    253  
    254 /* Get the feature info for lm78 sensor. */ 
    255 int get_feat_info_lm78( updates *node, sensors_chip_name name, int num ) { 
    256     switch (num) { 
    257         case 1: 
    258             node->featnum = SENSORS_LM78_IN0; 
    259             node->featminnum = SENSORS_LM78_IN0_MIN; 
    260             node->featmaxnum = SENSORS_LM78_IN0_MAX; 
    261             node->feattype = VOLT; 
    262             break; 
    263         case 2: 
    264             node->featnum = SENSORS_LM78_IN1; 
    265             node->featminnum = SENSORS_LM78_IN1_MIN; 
    266             node->featmaxnum = SENSORS_LM78_IN1_MAX; 
    267             node->feattype = VOLT; 
    268             break; 
    269         case 3: 
    270             node->featnum = SENSORS_LM78_IN2; 
    271             node->featminnum = SENSORS_LM78_IN2_MIN; 
    272             node->featmaxnum = SENSORS_LM78_IN2_MAX; 
    273             node->feattype = VOLT; 
    274             break; 
    275         case 4: 
    276             node->featnum = SENSORS_LM78_IN3; 
    277             node->featminnum = SENSORS_LM78_IN3_MIN; 
    278             node->featmaxnum = SENSORS_LM78_IN3_MAX; 
    279             node->feattype = VOLT; 
    280             break; 
    281         case 5: 
    282             node->featnum = SENSORS_LM78_IN4; 
    283             node->featminnum = SENSORS_LM78_IN4_MIN; 
    284             node->featmaxnum = SENSORS_LM78_IN4_MAX; 
    285             node->feattype = VOLT; 
    286             break; 
    287         case 6: 
    288             node->featnum = SENSORS_LM78_IN5; 
    289             node->featminnum = SENSORS_LM78_IN5_MIN; 
    290             node->featmaxnum = SENSORS_LM78_IN5_MAX; 
    291             node->feattype = VOLT; 
    292             break; 
    293         case 7: 
    294             node->featnum = SENSORS_LM78_IN6; 
    295             node->featminnum = SENSORS_LM78_IN6_MIN; 
    296             node->featmaxnum = SENSORS_LM78_IN6_MAX; 
    297             node->feattype = VOLT; 
    298             break; 
    299         case 8: 
    300             node->featnum = SENSORS_LM78_FAN1; 
    301             node->featminnum = SENSORS_LM78_FAN1_MIN; 
    302             node->featmaxnum = UNDEFMAXMIN; 
    303             node->feattype = FAN; 
    304             break; 
    305         case 9: 
    306             node->featnum = SENSORS_LM78_FAN2; 
    307             node->featminnum = SENSORS_LM78_FAN2_MIN; 
    308             node->featmaxnum = UNDEFMAXMIN; 
    309             node->feattype = FAN; 
    310             break; 
    311         case 10: 
    312             node->featnum = SENSORS_LM78_FAN3; 
    313             node->featminnum = SENSORS_LM78_FAN3_MIN; 
    314             node->featmaxnum = UNDEFMAXMIN; 
    315             node->feattype = FAN; 
    316             break; 
    317         case 11: 
    318             node->featnum = SENSORS_LM78_TEMP; 
    319             node->featminnum = UNDEFMAXMIN; 
    320             node->featmaxnum = SENSORS_LM78_TEMP_OVER; 
    321             node->feattype = TEMP; 
    322             break; 
    323         default: 
    324             return FAILURE; 
    325             break; 
    326     } 
    327  
    328     return SUCCESS; 
    329 } 
    330  
    331 #define LM78J_NUM_FEAT 11 
    332  
    333 /* Get the feature info for lm78 sensor. */ 
    334 int get_feat_info_lm78j( updates *node, sensors_chip_name name, int num ) { 
    335     switch (num) { 
    336         case 1: 
    337             node->featnum = SENSORS_LM78J_IN0; 
    338             node->featminnum = SENSORS_LM78J_IN0_MIN; 
    339             node->featmaxnum = SENSORS_LM78J_IN0_MAX; 
    340             node->feattype = VOLT; 
    341             break; 
    342         case 2: 
    343             node->featnum = SENSORS_LM78J_IN1; 
    344             node->featminnum = SENSORS_LM78J_IN1_MIN; 
    345             node->featmaxnum = SENSORS_LM78J_IN1_MAX; 
    346             node->feattype = VOLT; 
    347             break; 
    348         case 3: 
    349             node->featnum = SENSORS_LM78J_IN2; 
    350             node->featminnum = SENSORS_LM78J_IN2_MIN; 
    351             node->featmaxnum = SENSORS_LM78J_IN2_MAX; 
    352             node->feattype = VOLT; 
    353             break; 
    354         case 4: 
    355             node->featnum = SENSORS_LM78J_IN3; 
    356             node->featminnum = SENSORS_LM78J_IN3_MIN; 
    357             node->featmaxnum = SENSORS_LM78J_IN3_MAX; 
    358             node->feattype = VOLT; 
    359             break; 
    360         case 5: 
    361             node->featnum = SENSORS_LM78J_IN4; 
    362             node->featminnum = SENSORS_LM78J_IN4_MIN; 
    363             node->featmaxnum = SENSORS_LM78J_IN4_MAX; 
    364             node->feattype = VOLT; 
    365             break; 
    366         case 6: 
    367             node->featnum = SENSORS_LM78J_IN5; 
    368             node->featminnum = SENSORS_LM78J_IN5_MIN; 
    369             node->featmaxnum = SENSORS_LM78J_IN5_MAX; 
    370             node->feattype = VOLT; 
    371             break; 
    372         case 7: 
    373             node->featnum = SENSORS_LM78J_IN6; 
    374             node->featminnum = SENSORS_LM78J_IN6_MIN; 
    375             node->featmaxnum = SENSORS_LM78J_IN6_MAX; 
    376             node->feattype = VOLT; 
    377             break; 
    378         case 8: 
    379             node->featnum = SENSORS_LM78J_FAN1; 
    380             node->featminnum = SENSORS_LM78J_FAN1_MIN; 
    381             node->featmaxnum = UNDEFMAXMIN; 
    382             node->feattype = FAN; 
    383             break; 
    384         case 9: 
    385             node->featnum = SENSORS_LM78J_FAN2; 
    386             node->featminnum = SENSORS_LM78J_FAN2_MIN; 
    387             node->featmaxnum = UNDEFMAXMIN; 
    388             node->feattype = FAN; 
    389             break; 
    390         case 10: 
    391             node->featnum = SENSORS_LM78J_FAN3; 
    392             node->featminnum = SENSORS_LM78J_FAN3_MIN; 
    393             node->featmaxnum = UNDEFMAXMIN; 
    394             node->feattype = FAN; 
    395             break; 
    396         case 11: 
    397             node->featnum = SENSORS_LM78J_TEMP; 
    398             node->featminnum = UNDEFMAXMIN; 
    399             node->featmaxnum = SENSORS_LM78J_TEMP_OVER; 
    400             node->feattype = TEMP; 
    401             break; 
    402         default: 
    403             return FAILURE; 
    404             break; 
    405     } 
    406  
    407     return SUCCESS; 
    408 } 
    409  
    410 #define LM79_NUM_FEAT 11 
    411  
    412 /* Get the feature info for lm78 sensor. */ 
    413 int get_feat_info_lm79( updates *node, sensors_chip_name name, int num ) { 
    414     switch (num) { 
    415         case 1: 
    416             node->featnum = SENSORS_LM79_IN0; 
    417             node->featminnum = SENSORS_LM79_IN0_MIN; 
    418             node->featmaxnum = SENSORS_LM79_IN0_MAX; 
    419             node->feattype = VOLT; 
    420             break; 
    421         case 2: 
    422             node->featnum = SENSORS_LM79_IN1; 
    423             node->featminnum = SENSORS_LM79_IN1_MIN; 
    424             node->featmaxnum = SENSORS_LM79_IN1_MAX; 
    425             node->feattype = VOLT; 
    426             break; 
    427         case 3: 
    428             node->featnum = SENSORS_LM79_IN2; 
    429             node->featminnum = SENSORS_LM79_IN2_MIN; 
    430             node->featmaxnum = SENSORS_LM79_IN2_MAX; 
    431             node->feattype = VOLT; 
    432             break; 
    433         case 4: 
    434             node->featnum = SENSORS_LM79_IN3; 
    435             node->featminnum = SENSORS_LM79_IN3_MIN; 
    436             node->featmaxnum = SENSORS_LM79_IN3_MAX; 
    437             node->feattype = VOLT; 
    438             break; 
    439         case 5: 
    440             node->featnum = SENSORS_LM79_IN4; 
    441             node->featminnum = SENSORS_LM79_IN4_MIN; 
    442             node->featmaxnum = SENSORS_LM79_IN4_MAX; 
    443             node->feattype = VOLT; 
    444             break; 
    445         case 6: 
    446             node->featnum = SENSORS_LM79_IN5; 
    447             node->featminnum = SENSORS_LM79_IN5_MIN; 
    448             node->featmaxnum = SENSORS_LM79_IN5_MAX; 
    449             node->feattype = VOLT; 
    450             break; 
    451         case 7: 
    452             node->featnum = SENSORS_LM79_IN6; 
    453             node->featminnum = SENSORS_LM79_IN6_MIN; 
    454             node->featmaxnum = SENSORS_LM79_IN6_MAX; 
    455             node->feattype = VOLT; 
    456             break; 
    457         case 8: 
    458             node->featnum = SENSORS_LM79_FAN1; 
    459             node->featminnum = SENSORS_LM79_FAN1_MIN; 
    460             node->featmaxnum = UNDEFMAXMIN; 
    461             node->feattype = FAN; 
    462             break; 
    463         case 9: 
    464             node->featnum = SENSORS_LM79_FAN2; 
    465             node->featminnum = SENSORS_LM79_FAN2_MIN; 
    466             node->featmaxnum = UNDEFMAXMIN; 
    467             node->feattype = FAN; 
    468             break; 
    469         case 10: 
    470             node->featnum = SENSORS_LM79_FAN3; 
    471             node->featminnum = SENSORS_LM79_FAN3_MIN; 
    472             node->featmaxnum = UNDEFMAXMIN; 
    473             node->feattype = FAN; 
    474             break; 
    475         case 11: 
    476             node->featnum = SENSORS_LM79_TEMP; 
    477             node->featminnum = UNDEFMAXMIN; 
    478             node->featmaxnum = SENSORS_LM79_TEMP_OVER; 
    479             node->feattype = TEMP; 
    480             break; 
    481         default: 
    482             return FAILURE; 
    483             break; 
    484     } 
    485  
    486     return SUCCESS; 
    487 } 
    488  
    489  
    490 #define LM80_NUM_FEAT 10 
    491  
    492 /* Get the feature info for lm80 sensor. */ 
    493 int get_feat_info_lm80( updates *node, sensors_chip_name name, int num ) { 
    494     switch (num) { 
    495         case 1: 
    496             node->featnum = SENSORS_LM80_IN0; 
    497             node->featminnum = SENSORS_LM80_IN0_MIN; 
    498             node->featmaxnum = SENSORS_LM80_IN0_MAX; 
    499             node->feattype = VOLT; 
    500             break; 
    501         case 2: 
    502             node->featnum = SENSORS_LM80_IN1; 
    503             node->featminnum = SENSORS_LM80_IN1_MIN; 
    504             node->featmaxnum = SENSORS_LM80_IN1_MAX; 
    505             node->feattype = VOLT; 
    506             break; 
    507         case 3: 
    508             node->featnum = SENSORS_LM80_IN2; 
    509             node->featminnum = SENSORS_LM80_IN2_MIN; 
    510             node->featmaxnum = SENSORS_LM80_IN2_MAX; 
    511             node->feattype = VOLT; 
    512             break; 
    513         case 4: 
    514             node->featnum = SENSORS_LM80_IN3; 
    515             node->featminnum = SENSORS_LM80_IN3_MIN; 
    516             node->featmaxnum = SENSORS_LM80_IN3_MAX; 
    517             node->feattype = VOLT; 
    518             break; 
    519         case 5: 
    520             node->featnum = SENSORS_LM80_IN4; 
    521             node->featminnum = SENSORS_LM80_IN4_MIN; 
    522             node->featmaxnum = SENSORS_LM80_IN4_MAX; 
    523             node->feattype = VOLT; 
    524             break; 
    525         case 6: 
    526             node->featnum = SENSORS_LM80_IN5; 
    527             node->featminnum = SENSORS_LM80_IN5_MIN; 
    528             node->featmaxnum = SENSORS_LM80_IN5_MAX; 
    529             node->feattype = VOLT; 
    530             break; 
    531         case 7: 
    532             node->featnum = SENSORS_LM80_IN6; 
    533             node->featminnum = SENSORS_LM80_IN6_MIN; 
    534             node->featmaxnum = SENSORS_LM80_IN6_MAX; 
    535             node->feattype = VOLT; 
    536             break; 
    537         case 8: 
    538             node->featnum = SENSORS_LM80_FAN1; 
    539             node->featminnum = SENSORS_LM80_FAN1_MIN; 
    540             node->featmaxnum = UNDEFMAXMIN; 
    541             node->feattype = FAN; 
    542             break; 
    543         case 9: 
    544             node->featnum = SENSORS_LM80_FAN2; 
    545             node->featminnum = SENSORS_LM80_FAN2_MIN; 
    546             node->featmaxnum = UNDEFMAXMIN; 
    547             node->feattype = FAN; 
    548             break; 
    549         case 10: 
    550             node->featnum = SENSORS_LM80_TEMP; 
    551             node->featminnum = UNDEFMAXMIN; 
    552             node->featmaxnum = SENSORS_LM80_TEMP_HOT_MAX; 
    553             node->feattype = TEMP; 
    554             break; 
    555         default: 
    556             return FAILURE; 
    557             break; 
    558     } 
    559  
    560     return SUCCESS; 
    561 } 
    562  
    563 #define LM85_NUM_FEAT 12 
    564  
    565 /* Get the feature info for lm87 sensor. */ 
    566 int get_feat_info_lm85( updates *node, sensors_chip_name name, int num ) { 
    567     switch (num) { 
    568         case 1: 
    569             node->featnum = SENSORS_LM85_IN0; 
    570             node->featminnum = SENSORS_LM85_IN0_MIN; 
    571             node->featmaxnum = SENSORS_LM85_IN0_MAX; 
    572             node->feattype = VOLT; 
    573             break; 
    574         case 2: 
    575             node->featnum = SENSORS_LM85_IN1; 
    576             node->featminnum = SENSORS_LM85_IN1_MIN; 
    577             node->featmaxnum = SENSORS_LM85_IN1_MAX; 
    578             node->feattype = VOLT; 
    579             break; 
    580         case 3: 
    581             node->featnum = SENSORS_LM85_IN2; 
    582             node->featminnum = SENSORS_LM85_IN2_MIN; 
    583             node->featmaxnum = SENSORS_LM85_IN2_MAX; 
    584             node->feattype = VOLT; 
    585             break; 
    586         case 4: 
    587             node->featnum = SENSORS_LM85_IN3; 
    588             node->featminnum = SENSORS_LM85_IN3_MIN; 
    589             node->featmaxnum = SENSORS_LM85_IN3_MAX; 
    590             node->feattype = VOLT; 
    591             break; 
    592         case 5: 
    593             node->featnum = SENSORS_LM85_IN4; 
    594             node->featminnum = SENSORS_LM85_IN4_MIN; 
    595             node->featmaxnum = SENSORS_LM85_IN4_MAX; 
    596             node->feattype = VOLT; 
    597             break; 
    598         case 6: 
    599             node->featnum = SENSORS_LM85_FAN1; 
    600             node->featminnum = SENSORS_LM85_FAN1_MIN; 
    601             node->featmaxnum = UNDEFMAXMIN; 
    602             node->feattype = FAN; 
    603             break; 
    604         case 7: 
    605             node->featnum = SENSORS_LM85_FAN2; 
    606             node->featminnum = SENSORS_LM85_FAN2_MIN; 
    607             node->featmaxnum = UNDEFMAXMIN; 
    608             node->feattype = FAN; 
    609             break; 
    610         case 8: 
    611             node->featnum = SENSORS_LM85_FAN3; 
    612             node->featminnum = SENSORS_LM85_FAN3_MIN; 
    613             node->featmaxnum = UNDEFMAXMIN; 
    614             node->feattype = FAN; 
    615             break; 
    616         case 9: 
    617             node->featnum = SENSORS_LM85_FAN4; 
    618             node->featminnum = SENSORS_LM85_FAN4_MIN; 
    619             node->featmaxnum = UNDEFMAXMIN; 
    620             node->feattype = FAN; 
    621             break; 
    622         case 10: 
    623             node->featnum = SENSORS_LM85_TEMP1; 
    624             node->featminnum = SENSORS_LM85_TEMP1_MIN; 
    625             node->featmaxnum = SENSORS_LM85_TEMP1_MAX; 
    626             node->feattype = TEMP; 
    627             break; 
    628         case 11: 
    629             node->featnum = SENSORS_LM85_TEMP2; 
    630             node->featminnum = SENSORS_LM85_TEMP2_MIN; 
    631             node->featmaxnum = SENSORS_LM85_TEMP2_MAX; 
    632             node->feattype = TEMP; 
    633             break; 
    634         case 12: 
    635             node->featnum = SENSORS_LM85_TEMP3; 
    636             node->featminnum = SENSORS_LM85_TEMP3_MIN; 
    637             node->featmaxnum = SENSORS_LM85_TEMP3_MAX; 
    638             node->feattype = TEMP; 
    639             break; 
    640         default: 
    641             return FAILURE; 
    642             break; 
    643     } 
    644  
    645     return SUCCESS; 
    646 } 
    647  
    648 #define LM87_NUM_FEAT 13 
    649  
    650 /* Get the feature info for lm87 sensor. */ 
    651 int get_feat_info_lm87( updates *node, sensors_chip_name name, int num ) { 
    652     switch (num) { 
    653         case 1: 
    654             node->featnum = SENSORS_LM87_IN0; 
    655             node->featminnum = SENSORS_LM87_IN0_MIN; 
    656             node->featmaxnum = SENSORS_LM87_IN0_MAX; 
    657             node->feattype = VOLT; 
    658             break; 
    659         case 2: 
    660             node->featnum = SENSORS_LM87_IN1; 
    661             node->featminnum = SENSORS_LM87_IN1_MIN; 
    662             node->featmaxnum = SENSORS_LM87_IN1_MAX; 
    663             node->feattype = VOLT; 
    664             break; 
    665         case 3: 
    666             node->featnum = SENSORS_LM87_IN2; 
    667             node->featminnum = SENSORS_LM87_IN2_MIN; 
    668             node->featmaxnum = SENSORS_LM87_IN2_MAX; 
    669             node->feattype = VOLT; 
    670             break; 
    671         case 4: 
    672             node->featnum = SENSORS_LM87_IN3; 
    673             node->featminnum = SENSORS_LM87_IN3_MIN; 
    674             node->featmaxnum = SENSORS_LM87_IN3_MAX; 
    675             node->feattype = VOLT; 
    676             break; 
    677         case 5: 
    678             node->featnum = SENSORS_LM87_IN4; 
    679             node->featminnum = SENSORS_LM87_IN4_MIN; 
    680             node->featmaxnum = SENSORS_LM87_IN4_MAX; 
    681             node->feattype = VOLT; 
    682             break; 
    683         case 6: 
    684             node->featnum = SENSORS_LM87_IN5; 
    685             node->featminnum = SENSORS_LM87_IN5_MIN; 
    686             node->featmaxnum = SENSORS_LM87_IN5_MAX; 
    687             node->feattype = VOLT; 
    688             break; 
    689         case 7: 
    690             node->featnum = SENSORS_LM87_AIN1; 
    691             node->featminnum = SENSORS_LM87_AIN1_MIN; 
    692             node->featmaxnum = SENSORS_LM87_AIN1_MAX; 
    693             node->feattype = VOLT; 
    694             break; 
    695         case 8: 
    696             node->featnum = SENSORS_LM87_AIN2; 
    697             node->featminnum = SENSORS_LM87_AIN2_MIN; 
    698             node->featmaxnum = SENSORS_LM87_AIN2_MAX; 
    699             node->feattype = VOLT; 
    700             break; 
    701         case 9: 
    702             node->featnum = SENSORS_LM87_FAN1; 
    703             node->featminnum = SENSORS_LM87_FAN1_MIN; 
    704             node->featmaxnum = UNDEFMAXMIN; 
    705             node->feattype = FAN; 
    706             break; 
    707         case 10: 
    708             node->featnum = SENSORS_LM87_FAN2; 
    709             node->featminnum = SENSORS_LM87_FAN2_MIN; 
    710             node->featmaxnum = UNDEFMAXMIN; 
    711             node->feattype = FAN; 
    712             break; 
    713         case 11: 
    714             node->featnum = SENSORS_LM87_TEMP1; 
    715             node->featminnum = UNDEFMAXMIN; 
    716             node->featmaxnum = SENSORS_LM87_TEMP1_OVER; 
    717             node->feattype = TEMP; 
    718             break; 
    719         case 12: 
    720             node->featnum = SENSORS_LM87_TEMP2; 
    721             node->featminnum = UNDEFMAXMIN; 
    722             node->featmaxnum = SENSORS_LM87_TEMP2_OVER; 
    723             node->feattype = TEMP; 
    724             break; 
    725         case 13: 
    726             node->featnum = SENSORS_LM87_TEMP3; 
    727             node->featminnum = UNDEFMAXMIN; 
    728             node->featmaxnum = SENSORS_LM87_TEMP3_OVER; 
    729             node->feattype = TEMP; 
    730             break; 
    731         default: 
    732             return FAILURE; 
    733             break; 
    734     } 
    735  
    736     return SUCCESS; 
    737 } 
    738  
    739 #define LM90_NUM_FEAT 2 
    740  
    741 /* Get the feature info for lm90 sensor. */ 
    742 int get_feat_info_lm90( updates *node, sensors_chip_name name, int num ) { 
    743     switch (num) { 
    744         case 1: 
    745             node->featnum = SENSORS_LM90_LOCAL_TEMP; 
    746             node->featminnum = SENSORS_LM90_LOCAL_LOW; 
    747             node->featmaxnum = SENSORS_LM90_LOCAL_HIGH; 
    748             node->feattype = TEMP; 
    749             break; 
    750         case 2: 
    751             node->featnum = SENSORS_LM90_REMOTE_TEMP; 
    752             node->featminnum = SENSORS_LM90_REMOTE_LOW; 
    753             node->featmaxnum = SENSORS_LM90_REMOTE_HIGH; 
    754             node->feattype = TEMP; 
    755             break; 
    756         default: 
    757             return FAILURE; 
    758             break; 
    759     } 
    760  
    761     return SUCCESS; 
    762 } 
    763  
    764 #define MAX1617_NUM_FEAT 2 
    765  
    766 /* Get the feature info for max1617 sensor. */ 
    767 int get_feat_info_max1617( updates *node, sensors_chip_name name, int num ) { 
    768     switch (num) { 
    769         case 1: 
    770             node->featnum = SENSORS_MAX1617_TEMP; 
    771             node->featminnum = UNDEFMAXMIN; 
    772             node->featmaxnum = SENSORS_MAX1617_TEMP_OVER; 
    773             node->feattype = TEMP; 
    774             break; 
    775         case 2: 
    776             node->featnum = SENSORS_MAX1617_REMOTE_TEMP; 
    777             node->featminnum = UNDEFMAXMIN; 
    778             node->featmaxnum = SENSORS_MAX1617_REMOTE_TEMP_OVER; 
    779             node->feattype = TEMP; 
    780             break; 
    781         default: 
    782             return FAILURE; 
    783     } 
    784   
    785     return SUCCESS; 
    786 } 
    787  
    788 #define MAX1617A_NUM_FEAT 2 
    789  
    790 /* Get the feature info for max1617a sensor. */ 
    791 int get_feat_info_max1617a( updates *node, sensors_chip_name name, int num ) { 
    792     switch (num) { 
    793         case 1: 
    794             node->featnum = SENSORS_MAX1617A_TEMP; 
    795             node->featminnum = UNDEFMAXMIN; 
    796             node->featmaxnum = SENSORS_MAX1617A_TEMP_OVER; 
    797             node->feattype = TEMP; 
    798             break; 
    799         case 2: 
    800             node->featnum = SENSORS_MAX1617A_REMOTE_TEMP; 
    801             node->featminnum = UNDEFMAXMIN; 
    802             node->featmaxnum = SENSORS_MAX1617A_REMOTE_TEMP_OVER; 
    803             node->feattype = TEMP; 
    804             break; 
    805         default: 
    806             return FAILURE; 
    807     } 
    808   
    809     return SUCCESS; 
    810 } 
    811  
    812 #define SMSC47M1_NUM_FEAT 2 
    813  
    814 /* Get the feature info for smsc47m1 sensor. */ 
    815 int get_feat_info_smsc47m1( updates *node, sensors_chip_name name, int num ) { 
    816     switch (num) { 
    817         case 1: 
    818             node->featnum = SENSORS_SMSC47M1_FAN1; 
    819             node->featminnum = SENSORS_SMSC47M1_FAN1_MIN; 
    820             node->featmaxnum = UNDEFMAXMIN; 
    821             node->feattype = FAN; 
    822             break; 
    823         case 2: 
    824             node->featnum = SENSORS_SMSC47M1_FAN2; 
    825             node->featminnum = SENSORS_SMSC47M1_FAN2_MIN; 
    826             node->featmaxnum = UNDEFMAXMIN; 
    827             node->feattype = FAN; 
    828             break; 
    829         default: 
    830             return FAILURE; 
    831     } 
    832  
    833     return SUCCESS; 
    834 } 
    835  
    836 #define SMSC47M192_NUM_FEAT 11 
    837  
    838 /* Get the feature info for smsc47m192 sensor. */ 
    839 int get_feat_info_smsc47m192( updates *node, sensors_chip_name name, int num ) { 
    840     switch (num) { 
    841         case 1: 
    842         case 2: 
    843         case 3: 
    844         case 4: 
    845         case 5: 
    846         case 6: 
    847         case 7: 
    848         case 8: 
    849             node->featnum = SENSORS_SMSC47M192_IN(num - 1); 
    850             node->featminnum = SENSORS_SMSC47M192_IN_MIN(num - 1); 
    851             node->featmaxnum = SENSORS_SMSC47M192_IN_MAX(num - 1); 
    852             node->feattype = VOLT; 
    853             break; 
    854         case 9: 
    855         case 10: 
    856         case 11: 
    857             node->featnum = SENSORS_SMSC47M192_TEMP(num - 8); 
    858             node->featminnum = SENSORS_SMSC47M192_TEMP_MIN(num - 8); 
    859             node->featmaxnum = SENSORS_SMSC47M192_TEMP_MAX(num - 8); 
    860             node->feattype = TEMP; 
    861             break; 
    862         default: 
    863             return FAILURE; 
    864     } 
    865  
    866     return SUCCESS; 
    867 } 
    868  
    869 #define SMSC47B397_NUM_FEAT 8 
    870                  
    871 /* Get the feature info for smsc47b397 sensor. */ 
    872 int get_feat_info_smsc47b397( updates *node, sensors_chip_name name, int num ) { 
    873     switch (num) { 
    874         case 1: 
    875             node->featnum = SENSORS_SMSC47B397_TEMP1; 
    876             node->featminnum = UNDEFMAXMIN; 
    877             node->featmaxnum = UNDEFMAXMIN; 
    878             node->feattype = TEMP; 
    879             break; 
    880         case 2: 
    881             node->featnum = SENSORS_SMSC47B397_TEMP2; 
    882             node->featminnum = UNDEFMAXMIN; 
    883             node->featmaxnum = UNDEFMAXMIN; 
    884             node->feattype = TEMP; 
    885             break; 
    886         case 3: 
    887             node->featnum = SENSORS_SMSC47B397_TEMP3; 
    888             node->featminnum = UNDEFMAXMIN; 
    889             node->featmaxnum = UNDEFMAXMIN; 
    890             node->feattype = TEMP; 
    891             break; 
    892         case 4: 
    893             node->featnum = SENSORS_SMSC47B397_TEMP4; 
    894             node->featminnum = UNDEFMAXMIN; 
    895             node->featmaxnum = UNDEFMAXMIN; 
    896             node->feattype = TEMP; 
    897             break; 
    898         case 5: 
    899             node->featnum = SENSORS_SMSC47B397_FAN1; 
    900             node->featminnum = UNDEFMAXMIN; 
    901             node->featmaxnum = UNDEFMAXMIN; 
    902             node->feattype = FAN; 
    903             break; 
    904         case 6: 
    905             node->featnum = SENSORS_SMSC47B397_FAN2; 
    906             node->featminnum = UNDEFMAXMIN; 
    907             node->featmaxnum = UNDEFMAXMIN; 
    908             node->feattype = FAN; 
    909             break; 
    910         case 7: 
    911             node->featnum = SENSORS_SMSC47B397_FAN3; 
    912             node->featminnum = UNDEFMAXMIN; 
    913             node->featmaxnum = UNDEFMAXMIN; 
    914             node->feattype = FAN; 
    915             break; 
    916         case 8: 
    917             node->featnum = SENSORS_SMSC47B397_FAN4; 
    918             node->featminnum = UNDEFMAXMIN; 
    919             node->featmaxnum = UNDEFMAXMIN; 
    920             node->feattype = FAN; 
    921             break; 
    922         default: 
    923             return FAILURE; 
    924     } 
    925  
    926     return SUCCESS; 
    927 } 
    928  
    929  
    930 #define VIA686A_NUM_FEAT 10 
    931                  
    932 /* Get the feature info for via686a sensor. */ 
    933 int get_feat_info_via686a( updates *node, sensors_chip_name name, int num ) { 
    934     switch (num) { 
    935         case 1: 
    936             node->featnum = SENSORS_VIA686A_IN0; 
    937             node->featminnum = SENSORS_VIA686A_IN0_MIN; 
    938             node->featmaxnum = SENSORS_VIA686A_IN0_MAX; 
    939             node->feattype = VOLT; 
    940             break; 
    941         case 2: 
    942             node->featnum = SENSORS_VIA686A_IN1; 
    943             node->featminnum = SENSORS_VIA686A_IN1_MIN; 
    944             node->featmaxnum = SENSORS_VIA686A_IN1_MAX; 
    945             node->feattype = VOLT; 
    946             break; 
    947         case 3: 
    948             node->featnum = SENSORS_VIA686A_IN2; 
    949             node->featminnum = SENSORS_VIA686A_IN2_MIN; 
    950             node->featmaxnum = SENSORS_VIA686A_IN2_MAX; 
    951             node->feattype = VOLT; 
    952             break; 
    953         case 4: 
    954             node->featnum = SENSORS_VIA686A_IN3; 
    955             node->featminnum = SENSORS_VIA686A_IN3_MIN; 
    956             node->featmaxnum = SENSORS_VIA686A_IN3_MAX; 
    957             node->feattype = VOLT; 
    958             break; 
    959         case 5: 
    960             node->featnum = SENSORS_VIA686A_IN4; 
    961             node->featminnum = SENSORS_VIA686A_IN4_MIN; 
    962             node->featmaxnum = SENSORS_VIA686A_IN4_MAX; 
    963             node->feattype = VOLT; 
    964             break; 
    965         case 6: 
    966             node->featnum = SENSORS_VIA686A_FAN1; 
    967             node->featminnum = SENSORS_VIA686A_FAN1_MIN; 
    968             node->featmaxnum = UNDEFMAXMIN; 
    969             node->feattype = FAN; 
    970             break; 
    971         case 7: 
    972             node->featnum = SENSORS_VIA686A_FAN2; 
    973             node->featminnum = SENSORS_VIA686A_FAN2_MIN; 
    974             node->featmaxnum = UNDEFMAXMIN; 
    975             node->feattype = FAN; 
    976             break; 
    977         case 8: 
    978             node->featnum = SENSORS_VIA686A_TEMP; 
    979             node->featminnum = UNDEFMAXMIN; 
    980             node->featmaxnum = SENSORS_VIA686A_TEMP_OVER; 
    981             node->feattype = TEMP; 
    982             break; 
    983         case 9: 
    984             node->featnum = SENSORS_VIA686A_TEMP2; 
    985             node->featminnum = UNDEFMAXMIN; 
    986             node->featmaxnum = SENSORS_VIA686A_TEMP2_OVER; 
    987             node->feattype = TEMP; 
    988             break; 
    989         case 10: 
    990             node->featnum = SENSORS_VIA686A_TEMP3; 
    991             node->featminnum = UNDEFMAXMIN; 
    992             node->featmaxnum = SENSORS_VIA686A_TEMP3_OVER; 
    993             node->feattype = TEMP; 
    994             break; 
    995         default: 
    996             return FAILURE; 
    997     } 
    998  
    999     return SUCCESS; 
    1000 } 
    1001  
    1002 #define W83781D_NUM_FEAT 13 
    1003                  
    1004 /* Get the feature info for w83781d sensor. */ 
    1005 int get_feat_info_w83781d( updates *node, sensors_chip_name name, int num ) { 
    1006     switch (num) { 
    1007         case 1: 
    1008             node->featnum = SENSORS_W83781D_IN0; 
    1009             node->featminnum = SENSORS_W83781D_IN0_MIN; 
    1010             node->featmaxnum = SENSORS_W83781D_IN0_MAX; 
    1011             node->feattype = VOLT; 
    1012             break; 
    1013         case 2: 
    1014             node->featnum = SENSORS_W83781D_IN1; 
    1015             node->featminnum = SENSORS_W83781D_IN1_MIN; 
    1016             node->featmaxnum = SENSORS_W83781D_IN1_MAX; 
    1017             node->feattype = VOLT; 
    1018             break; 
    1019         case 3: 
    1020             node->featnum = SENSORS_W83781D_IN2; 
    1021             node->featminnum = SENSORS_W83781D_IN2_MIN; 
    1022             node->featmaxnum = SENSORS_W83781D_IN2_MAX; 
    1023             node->feattype = VOLT; 
    1024             break; 
    1025         case 4: 
    1026             node->featnum = SENSORS_W83781D_IN3; 
    1027             node->featminnum = SENSORS_W83781D_IN3_MIN; 
    1028             node->featmaxnum = SENSORS_W83781D_IN3_MAX; 
    1029             node->feattype = VOLT; 
    1030             break; 
    1031         case 5: 
    1032             node->featnum = SENSORS_W83781D_IN4; 
    1033             node->featminnum = SENSORS_W83781D_IN4_MIN; 
    1034             node->featmaxnum = SENSORS_W83781D_IN4_MAX; 
    1035             node->feattype = VOLT; 
    1036             break; 
    1037         case 6: 
    1038             node->featnum = SENSORS_W83781D_IN5; 
    1039             node->featminnum = SENSORS_W83781D_IN5_MIN; 
    1040             node->featmaxnum = SENSORS_W83781D_IN5_MAX; 
    1041             node->feattype = VOLT; 
    1042             break; 
    1043         case 7: 
    1044             node->featnum = SENSORS_W83781D_IN6; 
    1045             node->featminnum = SENSORS_W83781D_IN6_MIN; 
    1046             node->featmaxnum = SENSORS_W83781D_IN6_MAX; 
    1047             node->feattype = VOLT; 
    1048             break; 
    1049         case 8: 
    1050             node->featnum = SENSORS_W83781D_FAN1; 
    1051             node->featminnum = SENSORS_W83781D_FAN1_MIN; 
    1052             node->featmaxnum = UNDEFMAXMIN; 
    1053             node->feattype = FAN; 
    1054             break; 
    1055         case 9: 
    1056             node->featnum = SENSORS_W83781D_FAN2; 
    1057             node->featminnum = SENSORS_W83781D_FAN2_MIN; 
    1058             node->featmaxnum = UNDEFMAXMIN; 
    1059             node->feattype = FAN; 
    1060             break; 
    1061         case 10: 
    1062             node->featnum = SENSORS_W83781D_FAN3; 
    1063             node->featminnum = SENSORS_W83781D_FAN3_MIN; 
    1064             node->featmaxnum = UNDEFMAXMIN; 
    1065             node->feattype = FAN; 
    1066             break; 
    1067         case 11: 
    1068             node->featnum = SENSORS_W83781D_TEMP1; 
    1069             node->featminnum = UNDEFMAXMIN; 
    1070             node->featmaxnum = SENSORS_W83781D_TEMP1_OVER; 
    1071             node->feattype = TEMP; 
    1072             break; 
    1073         case 12: 
    1074             node->featnum = SENSORS_W83781D_TEMP2; 
    1075             node->featminnum = UNDEFMAXMIN; 
    1076             node->featmaxnum = SENSORS_W83781D_TEMP2_OVER; 
    1077             node->feattype = TEMP; 
    1078             break; 
    1079         case 13: 
    1080             node->featnum = SENSORS_W83781D_TEMP3; 
    1081             node->featminnum = UNDEFMAXMIN; 
    1082             node->featmaxnum = SENSORS_W83781D_TEMP3_OVER; 
    1083             node->feattype = TEMP; 
    1084             break; 
    1085         default: 
    1086             return FAILURE; 
    1087     } 
    1088  
    1089     return SUCCESS; 
    1090 } 
    1091  
    1092 #define W83782D_NUM_FEAT 15 
    1093                  
    1094 /* Get the feature info for w83782d sensor. */ 
    1095 int get_feat_info_w83782d( updates *node, sensors_chip_name name, int num ) { 
    1096     switch (num) { 
    1097         case 1: 
    1098             node->featnum = SENSORS_W83782D_IN0; 
    1099             node->featminnum = SENSORS_W83782D_IN0_MIN; 
    1100             node->featmaxnum = SENSORS_W83782D_IN0_MAX; 
    1101             node->feattype = VOLT; 
    1102             break; 
    1103         case 2: 
    1104             node->featnum = SENSORS_W83782D_IN1; 
    1105             node->featminnum = SENSORS_W83782D_IN1_MIN; 
    1106             node->featmaxnum = SENSORS_W83782D_IN1_MAX; 
    1107             node->feattype = VOLT; 
    1108             break; 
    1109         case 3: 
    1110             node->featnum = SENSORS_W83782D_IN2; 
    1111             node->featminnum = SENSORS_W83782D_IN2_MIN; 
    1112             node->featmaxnum = SENSORS_W83782D_IN2_MAX; 
    1113             node->feattype = VOLT; 
    1114             break; 
    1115         case 4: 
    1116             node->featnum = SENSORS_W83782D_IN3; 
    1117             node->featminnum = SENSORS_W83782D_IN3_MIN; 
    1118             node->featmaxnum = SENSORS_W83782D_IN3_MAX; 
    1119             node->feattype = VOLT; 
    1120             break; 
    1121         case 5: 
    1122             node->featnum = SENSORS_W83782D_IN4; 
    1123             node->featminnum = SENSORS_W83782D_IN4_MIN; 
    1124             node->featmaxnum = SENSORS_W83782D_IN4_MAX; 
    1125             node->feattype = VOLT; 
    1126             break; 
    1127         case 6: 
    1128             node->featnum = SENSORS_W83782D_IN5; 
    1129             node->featminnum = SENSORS_W83782D_IN5_MIN; 
    1130             node->featmaxnum = SENSORS_W83782D_IN5_MAX; 
    1131             node->feattype = VOLT; 
    1132             break; 
    1133         case 7: 
    1134             node->featnum = SENSORS_W83782D_IN6; 
    1135             node->featminnum = SENSORS_W83782D_IN6_MIN; 
    1136             node->featmaxnum = SENSORS_W83782D_IN6_MAX; 
    1137             node->feattype = VOLT; 
    1138             break; 
    1139         case 8: 
    1140             node->featnum = SENSORS_W83782D_IN7; 
    1141             node->featminnum = SENSORS_W83782D_IN7_MIN; 
    1142             node->featmaxnum = SENSORS_W83782D_IN7_MAX; 
    1143             node->feattype = VOLT; 
    1144             break; 
    1145         case 9: 
    1146             node->featnum = SENSORS_W83782D_IN8; 
    1147             node->featminnum = SENSORS_W83782D_IN8_MIN; 
    1148             node->featmaxnum = SENSORS_W83782D_IN8_MAX; 
    1149             node->feattype = VOLT; 
    1150             break; 
    1151         case 10: 
    1152             node->featnum = SENSORS_W83782D_FAN1; 
    1153             node->featminnum = SENSORS_W83782D_FAN1_MIN; 
    1154             node->featmaxnum = UNDEFMAXMIN; 
    1155             node->feattype = FAN; 
    1156             break; 
    1157         case 11: 
    1158             node->featnum = SENSORS_W83782D_FAN2; 
    1159             node->featminnum = SENSORS_W83782D_FAN2_MIN; 
    1160             node->featmaxnum = UNDEFMAXMIN; 
    1161             node->feattype = FAN; 
    1162             break; 
    1163         case 12: 
    1164             node->featnum = SENSORS_W83782D_FAN3; 
    1165             node->featminnum = SENSORS_W83782D_FAN3_MIN; 
    1166             node->featmaxnum = UNDEFMAXMIN; 
    1167             node->feattype = FAN; 
    1168             break; 
    1169         case 13: 
    1170             node->featnum = SENSORS_W83782D_TEMP1; 
    1171             node->featminnum = UNDEFMAXMIN; 
    1172             node->featmaxnum = SENSORS_W83782D_TEMP1_OVER; 
    1173             node->feattype = TEMP; 
    1174             break; 
    1175         case 14: 
    1176             node->featnum = SENSORS_W83782D_TEMP2; 
    1177             node->featminnum = UNDEFMAXMIN; 
    1178             node->featmaxnum = SENSORS_W83782D_TEMP2_OVER; 
    1179             node->feattype = TEMP; 
    1180             break; 
    1181         case 15: 
    1182             node->featnum = SENSORS_W83782D_TEMP3; 
    1183             node->featminnum = UNDEFMAXMIN; 
    1184             node->featmaxnum = SENSORS_W83782D_TEMP3_OVER; 
    1185             node->feattype = TEMP; 
    1186             break; 
    1187         default: 
    1188             return FAILURE; 
    1189     } 
    1190  
    1191     return SUCCESS; 
    1192 } 
    1193  
    1194  
    1195 #define W83627EHF_NUM_FEAT 16 
    1196                  
    1197 /* Get the feature info for w83627ehf sensor. */ 
    1198 int get_feat_info_w83627ehf( updates *node, sensors_chip_name name, int num ) { 
    1199     switch (num) { 
    1200         case 1: 
    1201             node->featnum = SENSORS_W83627EHF_IN0; 
    1202             node->featminnum = SENSORS_W83627EHF_IN0_MIN; 
    1203             node->featmaxnum = SENSORS_W83627EHF_IN0_MAX; 
    1204             node->feattype = VOLT; 
    1205             break; 
    1206         case 2: 
    1207             node->featnum = SENSORS_W83627EHF_IN1; 
    1208             node->featminnum = SENSORS_W83627EHF_IN1_MIN; 
    1209             node->featmaxnum = SENSORS_W83627EHF_IN1_MAX; 
    1210             node->feattype = VOLT; 
    1211             break; 
    1212         case 3: 
    1213             node->featnum = SENSORS_W83627EHF_IN2; 
    1214             node->featminnum = SENSORS_W83627EHF_IN2_MIN; 
    1215             node->featmaxnum = SENSORS_W83627EHF_IN2_MAX; 
    1216             node->feattype = VOLT; 
    1217             break; 
    1218         case 4: 
    1219             node->featnum = SENSORS_W83627EHF_IN3; 
    1220             node->featminnum = SENSORS_W83627EHF_IN3_MIN; 
    1221             node->featmaxnum = SENSORS_W83627EHF_IN3_MAX; 
    1222             node->feattype = VOLT; 
    1223             break; 
    1224         case 5: 
    1225             node->featnum = SENSORS_W83627EHF_IN4; 
    1226             node->featminnum = SENSORS_W83627EHF_IN4_MIN; 
    1227             node->featmaxnum = SENSORS_W83627EHF_IN4_MAX; 
    1228             node->feattype = VOLT; 
    1229             break; 
    1230         case 6: 
    1231             node->featnum = SENSORS_W83627EHF_IN5; 
    1232             node->featminnum = SENSORS_W83627EHF_IN5_MIN; 
    1233             node->featmaxnum = SENSORS_W83627EHF_IN5_MAX; 
    1234             node->feattype = VOLT; 
    1235             break; 
    1236         case 7: 
    1237             node->featnum = SENSORS_W83627EHF_IN6; 
    1238             node->featminnum = SENSORS_W83627EHF_IN6_MIN; 
    1239             node->featmaxnum = SENSORS_W83627EHF_IN6_MAX; 
    1240             node->feattype = VOLT; 
    1241             break; 
    1242         case 8: 
    1243             node->featnum = SENSORS_W83627EHF_IN7; 
    1244             node->featminnum = SENSORS_W83627EHF_IN7_MIN; 
    1245             node->featmaxnum = SENSORS_W83627EHF_IN7_MAX; 
    1246             node->feattype = VOLT; 
    1247             break; 
    1248         case 9: 
    1249             node->featnum = SENSORS_W83627EHF_IN8; 
    1250             node->featminnum = SENSORS_W83627EHF_IN8_MIN; 
    1251             node->featmaxnum = SENSORS_W83627EHF_IN8_MAX; 
    1252             node->feattype = VOLT; 
    1253             break; 
    1254         case 10: 
    1255             node->featnum = SENSORS_W83627EHF_IN9; 
    1256             node->featminnum = SENSORS_W83627EHF_IN9_MIN; 
    1257             node->featmaxnum = SENSORS_W83627EHF_IN9_MAX; 
    1258             node->feattype = VOLT; 
    1259             break; 
    1260         case 11: 
    1261             node->featnum = SENSORS_W83627EHF_FAN1; 
    1262             node->featminnum = SENSORS_W83627EHF_FAN1_MIN; 
    1263             node->featmaxnum = UNDEFMAXMIN; 
    1264             node->feattype = FAN; 
    1265             break; 
    1266         case 12: 
    1267             node->featnum = SENSORS_W83627EHF_FAN2; 
    1268             node->featminnum = SENSORS_W83627EHF_FAN2_MIN; 
    1269             node->featmaxnum = UNDEFMAXMIN; 
    1270             node->feattype = FAN; 
    1271             break; 
    1272         case 13: 
    1273             node->featnum = SENSORS_W83627EHF_FAN3; 
    1274             node->featminnum = SENSORS_W83627EHF_FAN3_MIN; 
    1275             node->featmaxnum = UNDEFMAXMIN; 
    1276             node->feattype = FAN; 
    1277             break; 
    1278         case 14: 
    1279             node->featnum = SENSORS_W83627EHF_TEMP1; 
    1280             node->featminnum = UNDEFMAXMIN; 
    1281             node->featmaxnum = SENSORS_W83627EHF_TEMP1_OVER; 
    1282             node->feattype = TEMP; 
    1283             break; 
    1284         case 15: 
    1285             node->featnum = SENSORS_W83627EHF_TEMP2; 
    1286             node->featminnum = UNDEFMAXMIN; 
    1287             node->featmaxnum = SENSORS_W83627EHF_TEMP2_OVER; 
    1288             node->feattype = TEMP; 
    1289             break; 
    1290         case 16: 
    1291             node->featnum = SENSORS_W83627EHF_TEMP3; 
    1292             node->featminnum = UNDEFMAXMIN; 
    1293             node->featmaxnum = SENSORS_W83627EHF_TEMP3_OVER; 
    1294             node->feattype = TEMP; 
    1295             break; 
    1296         default: 
    1297             return FAILURE; 
    1298     } 
    1299  
    1300     return SUCCESS; 
    1301 } 
    1302  
    1303  
    1304  
    1305  
    1306 #define W83783S_NUM_FEAT 12 
    1307                  
    1308 /* Get the feature info for w83783s and w83697hf sensor. */ 
    1309 int get_feat_info_w83783s( updates *node, sensors_chip_name name, int num ) { 
    1310     switch (num) { 
    1311         case 1: 
    1312             node->featnum = SENSORS_W83783S_IN0; 
    1313             node->featminnum = SENSORS_W83783S_IN0_MIN; 
    1314             node->featmaxnum = SENSORS_W83783S_IN0_MAX; 
    1315             node->feattype = VOLT; 
    1316             break; 
    1317         case 2: 
    1318             node->featnum = SENSORS_W83783S_IN1; 
    1319             node->featminnum = SENSORS_W83783S_IN1_MIN; 
    1320             node->featmaxnum = SENSORS_W83783S_IN1_MAX; 
    1321             node->feattype = VOLT; 
    1322             break; 
    1323         case 3: 
    1324             node->featnum = SENSORS_W83783S_IN2; 
    1325             node->featminnum = SENSORS_W83783S_IN2_MIN; 
    1326             node->featmaxnum = SENSORS_W83783S_IN2_MAX; 
    1327             node->feattype = VOLT; 
    1328             break; 
    1329         case 4: 
    1330             node->featnum = SENSORS_W83783S_IN3; 
    1331             node->featminnum = SENSORS_W83783S_IN3_MIN; 
    1332             node->featmaxnum = SENSORS_W83783S_IN3_MAX; 
    1333             node->feattype = VOLT; 
    1334             break; 
    1335         case 5: 
    1336             node->featnum = SENSORS_W83783S_IN4; 
    1337             node->featminnum = SENSORS_W83783S_IN4_MIN; 
    1338             node->featmaxnum = SENSORS_W83783S_IN4_MAX; 
    1339             node->feattype = VOLT; 
    1340             break; 
    1341         case 6: 
    1342             node->featnum = SENSORS_W83783S_IN5; 
    1343             node->featminnum = SENSORS_W83783S_IN5_MIN; 
    1344             node->featmaxnum = SENSORS_W83783S_IN5_MAX; 
    1345             node->feattype = VOLT; 
    1346             break; 
    1347         case 7: 
    1348             node->featnum = SENSORS_W83783S_IN6; 
    1349             node->featminnum = SENSORS_W83783S_IN6_MIN; 
    1350             node->featmaxnum = SENSORS_W83783S_IN6_MAX; 
    1351             node->feattype = VOLT; 
    1352             break; 
    1353         case 8: 
    1354             node->featnum = SENSORS_W83783S_FAN1; 
    1355             node->featminnum = SENSORS_W83783S_FAN1_MIN; 
    1356             node->featmaxnum = UNDEFMAXMIN; 
    1357             node->feattype = FAN; 
    1358             break; 
    1359         case 9: 
    1360             node->featnum = SENSORS_W83783S_FAN2; 
    1361             node->featminnum = SENSORS_W83783S_FAN2_MIN; 
    1362             node->featmaxnum = UNDEFMAXMIN; 
    1363             node->feattype = FAN; 
    1364             break; 
    1365         case 10: 
    1366             node->featnum = SENSORS_W83783S_FAN3; 
    1367             node->featminnum = SENSORS_W83783S_FAN3_MIN; 
    1368             node->featmaxnum = UNDEFMAXMIN; 
    1369             node->feattype = FAN; 
    1370             break; 
    1371         case 11: 
    1372             node->featnum = SENSORS_W83783S_TEMP1; 
    1373             node->featminnum = UNDEFMAXMIN; 
    1374             node->featmaxnum = SENSORS_W83783S_TEMP1_OVER; 
    1375             node->feattype = TEMP; 
    1376             break; 
    1377         case 12: 
    1378             node->featnum = SENSORS_W83783S_TEMP2; 
    1379             node->featminnum = UNDEFMAXMIN; 
    1380             node->featmaxnum = SENSORS_W83783S_TEMP2_OVER; 
    1381             node->feattype = TEMP; 
    1382             break; 
    1383         default: 
    1384             return FAILURE; 
    1385     } 
    1386  
    1387     return SUCCESS; 
    1388 } 
    1389  
    1390 #define AS99127F_NUM_FEAT 15 
    1391                  
    1392 /* Get the feature info for as99127f sensor. */ 
    1393 int get_feat_info_as99127f( updates *node, sensors_chip_name name, int num ) { 
    1394     switch (num) { 
    1395         case 1: 
    1396             node->featnum = SENSORS_W83782D_IN0; 
    1397             node->featminnum = SENSORS_W83782D_IN0_MIN; 
    1398             node->featmaxnum = SENSORS_W83782D_IN0_MAX; 
    1399             node->feattype = VOLT; 
    1400             break; 
    1401         case 2: 
    1402             node->featnum = SENSORS_W83782D_IN1; 
    1403             node->featminnum = SENSORS_W83782D_IN1_MIN; 
    1404             node->featmaxnum = SENSORS_W83782D_IN1_MAX; 
    1405             node->feattype = VOLT; 
    1406             break; 
    1407         case 3: 
    1408             node->featnum = SENSORS_W83782D_IN2; 
    1409             node->featminnum = SENSORS_W83782D_IN2_MIN; 
    1410             node->featmaxnum = SENSORS_W83782D_IN2_MAX; 
    1411             node->feattype = VOLT; 
    1412             break; 
    1413         case 4: 
    1414             node->featnum = SENSORS_W83782D_IN3; 
    1415             node->featminnum = SENSORS_W83782D_IN3_MIN; 
    1416             node->featmaxnum = SENSORS_W83782D_IN3_MAX; 
    1417             node->feattype = VOLT; 
    1418             break; 
    1419         case 5: 
    1420             node->featnum = SENSORS_W83782D_IN4; 
    1421             node->featminnum = SENSORS_W83782D_IN4_MIN; 
    1422             node->featmaxnum = SENSORS_W83782D_IN4_MAX; 
    1423             node->feattype = VOLT; 
    1424             break; 
    1425         case 6: 
    1426             node->featnum = SENSORS_W83782D_IN5; 
    1427             node->featminnum = SENSORS_W83782D_IN5_MIN; 
    1428             node->featmaxnum = SENSORS_W83782D_IN5_MAX; 
    1429             node->feattype = VOLT; 
    1430             break; 
    1431         case 7: 
    1432             node->featnum = SENSORS_W83782D_IN6; 
    1433             node->featminnum = SENSORS_W83782D_IN6_MIN; 
    1434             node->featmaxnum = SENSORS_W83782D_IN6_MAX; 
    1435             node->feattype = VOLT; 
    1436             break; 
    1437         case 8: 
    1438             node->featnum = SENSORS_W83782D_IN7; 
    1439             node->featminnum = SENSORS_W83782D_IN7_MIN; 
    1440             node->featmaxnum = SENSORS_W83782D_IN7_MAX; 
    1441             node->feattype = VOLT; 
    1442             break; 
    1443         case 9: 
    1444             node->featnum = SENSORS_W83782D_IN8; 
    1445             node->featminnum = SENSORS_W83782D_IN8_MIN; 
    1446             node->featmaxnum = SENSORS_W83782D_IN8_MAX; 
    1447             node->feattype = VOLT; 
    1448             break; 
    1449         case 10: 
    1450             node->featnum = SENSORS_W83782D_FAN1; 
    1451             node->featminnum = SENSORS_W83782D_FAN1_MIN; 
    1452             node->featmaxnum = UNDEFMAXMIN; 
    1453             node->feattype = FAN; 
    1454             break; 
    1455         case 11: 
    1456             node->featnum = SENSORS_W83782D_FAN2; 
    1457             node->featminnum = SENSORS_W83782D_FAN2_MIN; 
    1458             node->featmaxnum = UNDEFMAXMIN; 
    1459             node->feattype = FAN; 
    1460             break; 
    1461         case 12: 
    1462             node->featnum = SENSORS_W83781D_FAN3; 
    1463             node->featminnum = SENSORS_W83781D_FAN3_MIN; 
    1464             node->featmaxnum = UNDEFMAXMIN; 
    1465             node->feattype = FAN; 
    1466             break; 
    1467         case 13: 
    1468             node->featnum = SENSORS_W83782D_TEMP1; 
    1469             node->featminnum = UNDEFMAXMIN; 
    1470             node->featmaxnum = SENSORS_W83782D_TEMP1_OVER; 
    1471             node->feattype = TEMP; 
    1472             break; 
    1473         case 14: 
    1474             node->featnum = SENSORS_W83781D_TEMP2; 
    1475             node->featminnum = UNDEFMAXMIN; 
    1476             node->featmaxnum = SENSORS_W83782D_TEMP2_OVER; 
    1477             node->feattype = TEMP; 
    1478             break; 
    1479         case 15: 
    1480             node->featnum = SENSORS_W83782D_TEMP3; 
    1481             node->featminnum = UNDEFMAXMIN; 
    1482             node->featmaxnum = SENSORS_W83782D_TEMP3_OVER; 
    1483             node->feattype = TEMP; 
    1484             break; 
    1485         default: 
    1486             return FAILURE; 
    1487     } 
    1488  
    1489     return SUCCESS; 
    1490 } 
    1491  
    1492 #define K8TEMP_NUM_FEAT 4 
    1493  
    1494 /* Get the feature info for k8temp sensor. */ 
    1495 int get_feat_info_k8temp( updates *node, sensors_chip_name name, int num ) { 
    1496     switch (num) { 
    1497         case 1: 
    1498             node->featnum = SENSORS_K8TEMP_TEMP1; 
    1499             node->featminnum = UNDEFMAXMIN; 
    1500             node->featmaxnum = UNDEFMAXMIN; 
    1501             node->feattype = TEMP; 
    1502             break; 
    1503         case 2: 
    1504             node->featnum = SENSORS_K8TEMP_TEMP2; 
    1505             node->featminnum = UNDEFMAXMIN; 
    1506             node->featmaxnum = UNDEFMAXMIN; 
    1507             node->feattype = TEMP; 
    1508             break; 
    1509         case 3: 
    1510             node->featnum = SENSORS_K8TEMP_TEMP3; 
    1511             node->featminnum = UNDEFMAXMIN; 
    1512             node->featmaxnum = UNDEFMAXMIN; 
    1513             node->feattype = TEMP; 
    1514             break; 
    1515         case 4: 
    1516             node->featnum = SENSORS_K8TEMP_TEMP4; 
    1517             node->featminnum = UNDEFMAXMIN; 
    1518             node->featmaxnum = UNDEFMAXMIN; 
    1519             node->feattype = TEMP; 
    1520             break; 
    1521         default: 
    1522             return FAILURE; 
    1523             break; 
    1524     } 
    1525  
    1526     return SUCCESS; 
    1527 } 
    1528  
    1529  
    1530 /* Simply return the number of features a specified sensor has from 
    1531  * defines above. 
    1532  */ 
    1533 int get_num_feat( sensors_chip_name name ) { 
    1534     if ( ( strcmp( name.prefix, SENSORS_ADM1021_PREFIX ) == 0 ) || 
    1535          ( strcmp( name.prefix, SENSORS_ADM1023_PREFIX ) == 0 ) || 
    1536          ( strcmp( name.prefix, SENSORS_LM84_PREFIX ) == 0 ) || 
    1537          ( strcmp( name.prefix, SENSORS_GL523_PREFIX ) == 0 ) || 
    1538          ( strcmp( name.prefix, SENSORS_THMC10_PREFIX ) == 0 ) ) { 
    1539         return ADM1021_NUM_FEAT; 
    1540     } else if ( strcmp( name.prefix, SENSORS_EEPROM_PREFIX ) == 0 ) { 
    1541         return EEPROM_NUM_FEAT; 
    1542     } else if ( strcmp( name.prefix, SENSORS_F71805F_PREFIX ) == 0 ) { 
    1543         return F71805F_NUM_FEAT; 
    1544     } else if ( strcmp( name.prefix, SENSORS_IT87_PREFIX ) == 0 ) { 
    1545         return IT87_NUM_FEAT; 
    1546     } else if ( strcmp( name.prefix, SENSORS_IT8712_PREFIX ) == 0 ) { 
    1547         return IT87_NUM_FEAT; 
    1548     } else if ( strcmp( name.prefix, SENSORS_LM75_PREFIX ) == 0 ) { 
    1549         return LM75_NUM_FEAT; 
    1550     } else if ( strcmp( name.prefix, SENSORS_LM78_PREFIX ) == 0 ) { 
    1551         return LM78_NUM_FEAT; 
    1552     } else if ( strcmp( name.prefix, SENSORS_LM78J_PREFIX ) == 0 ) { 
    1553         return LM78J_NUM_FEAT; 
    1554     } else if ( strcmp( name.prefix, SENSORS_LM79_PREFIX ) == 0 ) { 
    1555         return LM79_NUM_FEAT; 
    1556     } else if ( strcmp( name.prefix, SENSORS_LM80_PREFIX ) == 0 ) { 
    1557         return LM80_NUM_FEAT; 
    1558     } else if ( ( strcmp( name.prefix, SENSORS_LM85_PREFIX ) == 0 ) || 
    1559                 ( strcmp( name.prefix, SENSORS_LM85B_PREFIX ) == 0 ) || 
    1560                 ( strcmp( name.prefix, SENSORS_LM85C_PREFIX ) == 0 ) || 
    1561                 ( strcmp( name.prefix, SENSORS_ADM1027_PREFIX ) == 0 ) || 
    1562                 ( strcmp( name.prefix, SENSORS_ADT7463_PREFIX ) == 0 ) || 
    1563                 ( strcmp( name.prefix, SENSORS_EMC6D100_PREFIX ) == 0 ) ) { 
    1564         return LM85_NUM_FEAT; 
    1565     } else if ( strcmp( name.prefix, SENSORS_LM87_PREFIX ) == 0 ) { 
    1566         return LM87_NUM_FEAT; 
    1567     } else if ( ( strcmp( name.prefix, SENSORS_LM90_PREFIX ) == 0 ) || 
    1568                 ( strcmp( name.prefix, SENSORS_ADM1032_PREFIX ) == 0 ) ) { 
    1569         return LM90_NUM_FEAT; 
    1570     } else if ( ( strcmp( name.prefix, SENSORS_MAX1617_PREFIX ) == 0 ) || 
    1571                 ( strcmp( name.prefix, SENSORS_MC1066_PREFIX ) == 0 ) ) { 
    1572         return MAX1617_NUM_FEAT; 
    1573     } else if ( strcmp( name.prefix, SENSORS_MAX1617A_PREFIX ) == 0 ) { 
    1574         return MAX1617A_NUM_FEAT; 
    1575     } else if ( strcmp( name.prefix, SENSORS_SMSC47M1_PREFIX ) == 0 ) { 
    1576         return SMSC47M1_NUM_FEAT; 
    1577     } else if ( strcmp( name.prefix, SENSORS_SMSC47M192_PREFIX ) == 0 ) { 
    1578         return SMSC47M192_NUM_FEAT; 
    1579     } else if ( strcmp( name.prefix, SENSORS_SMSC47B397_PREFIX ) == 0 ) { 
    1580         return SMSC47B397_NUM_FEAT; 
    1581     } else if ( strcmp( name.prefix, SENSORS_VIA686A_PREFIX ) == 0 ) { 
    1582         return VIA686A_NUM_FEAT; 
    1583     } else if ( strcmp( name.prefix, SENSORS_W83781D_PREFIX ) == 0 ) { 
    1584         return W83781D_NUM_FEAT; 
    1585     } else if ( ( strcmp( name.prefix, SENSORS_W83782D_PREFIX ) == 0 ) || 
    1586                 ( strcmp( name.prefix, SENSORS_W83627HF_PREFIX ) == 0 ) || 
    1587                 ( strcmp( name.prefix, SENSORS_W83627THF_PREFIX ) == 0 ) || 
    1588                 ( strcmp( name.prefix, SENSORS_W83791D_PREFIX ) == 0 ) ) { 
    1589         return W83782D_NUM_FEAT; 
    1590     } else if ( ( strcmp( name.prefix, SENSORS_W83627EHF_PREFIX ) == 0 ) ) { 
    1591         return W83627EHF_NUM_FEAT; 
    1592     } else if ( ( strcmp( name.prefix, SENSORS_W83783S_PREFIX ) == 0 ) || 
    1593                 ( strcmp( name.prefix, SENSORS_W83697HF_PREFIX ) == 0 ) ) { 
    1594         return W83783S_NUM_FEAT; 
    1595     } else if ( strcmp( name.prefix, SENSORS_AS99127F_PREFIX ) == 0 ) { 
    1596         return AS99127F_NUM_FEAT; 
    1597     } else if ( strcmp( name.prefix, SENSORS_K8TEMP_PREFIX ) == 0 ) { 
    1598         return K8TEMP_NUM_FEAT; 
    1599     } else { 
    1600         return 0; 
    1601     } 
    1602 } 
    1603  
    160423/* Add a node to the feature linked list at the passed node pointer. */ 
    1605 updates *add_node( updates *node, sensors_chip_name name, GtkWidget *darea,  
    1606                    GtkWidget *pbar, int num ) { 
    1607     int retval = 0; 
     24updates *add_node( const sensors_chip_name *name, 
     25                   const sensors_feature *feature ) { 
     26    const sensors_subfeature *subfeature; 
     27    updates *node; 
    160828 
    160929    if( ( node = g_malloc( sizeof( updates ) ) ) == NULL ) { 
    161030        fprintf( stderr, "malloc failed!\n" ); 
    161131        return NULL; 
    161232    } 
    161333 
    1614     if ( ( strcmp( name.prefix, SENSORS_ADM1021_PREFIX ) == 0 ) || 
    1615          ( strcmp( name.prefix, SENSORS_ADM1023_PREFIX ) == 0 ) || 
    1616          ( strcmp( name.prefix, SENSORS_LM84_PREFIX ) == 0 ) || 
    1617          ( strcmp( name.prefix, SENSORS_GL523_PREFIX ) == 0 ) || 
    1618          ( strcmp( name.prefix, SENSORS_THMC10_PREFIX ) == 0 ) ) { 
    1619         retval = get_feat_info_adm1021( node, name, num ); 
    1620     } else if ( strcmp( name.prefix, SENSORS_EEPROM_PREFIX ) == 0 ) { 
    1621         retval = get_feat_info_eeprom( node, name, num ); 
    1622     } else if ( strcmp( name.prefix, SENSORS_F71805F_PREFIX ) == 0 ) { 
    1623         retval = get_feat_info_f71805f( node, name, num ); 
    1624     } else if ( strcmp( name.prefix, SENSORS_IT87_PREFIX ) == 0 ) { 
    1625         retval = get_feat_info_it87( node, name, num ); 
    1626     } else if ( strcmp( name.prefix, SENSORS_IT8712_PREFIX ) == 0 ) { 
    1627         retval = get_feat_info_it87( node, name, num ); 
    1628     } else if ( strcmp( name.prefix, SENSORS_LM75_PREFIX ) == 0 ) { 
    1629         retval = get_feat_info_lm75( node, name, num ); 
    1630     } else if ( strcmp( name.prefix, SENSORS_LM78_PREFIX ) == 0 ) { 
    1631         retval = get_feat_info_lm78( node, name, num ); 
    1632     } else if ( strcmp( name.prefix, SENSORS_LM78J_PREFIX ) == 0 ) { 
    1633         retval = get_feat_info_lm78j( node, name, num ); 
    1634     } else if ( strcmp( name.prefix, SENSORS_LM79_PREFIX ) == 0 ) { 
    1635         retval = get_feat_info_lm79( node, name, num ); 
    1636     } else if ( strcmp( name.prefix, SENSORS_LM80_PREFIX ) == 0 ) { 
    1637         retval = get_feat_info_lm80( node, name, num ); 
    1638     } else if ( ( strcmp( name.prefix, SENSORS_LM85_PREFIX ) == 0 ) || 
    1639                 ( strcmp( name.prefix, SENSORS_LM85B_PREFIX ) == 0 ) || 
    1640                 ( strcmp( name.prefix, SENSORS_LM85C_PREFIX ) == 0 ) || 
    1641                 ( strcmp( name.prefix, SENSORS_ADM1027_PREFIX ) == 0 ) || 
    1642                 ( strcmp( name.prefix, SENSORS_ADT7463_PREFIX ) == 0 ) || 
    1643                 ( strcmp( name.prefix, SENSORS_EMC6D100_PREFIX ) == 0 ) ) { 
    1644         retval = get_feat_info_lm85( node, name, num ); 
    1645     } else if ( strcmp( name.prefix, SENSORS_LM87_PREFIX ) == 0 ) { 
    1646         retval = get_feat_info_lm87( node, name, num ); 
    1647     } else if ( ( strcmp( name.prefix, SENSORS_LM90_PREFIX ) == 0 ) || 
    1648                 ( strcmp( name.prefix, SENSORS_ADM1032_PREFIX ) == 0 ) ) { 
    1649         retval = get_feat_info_lm90( node, name, num ); 
    1650     } else if ( ( strcmp( name.prefix, SENSORS_MAX1617_PREFIX ) == 0 ) || 
    1651                 ( strcmp( name.prefix, SENSORS_MC1066_PREFIX ) == 0 ) ) { 
    1652         retval = get_feat_info_max1617( node, name, num ); 
    1653     } else if ( strcmp( name.prefix, SENSORS_MAX1617A_PREFIX ) == 0 ) { 
    1654         retval = get_feat_info_max1617a( node, name, num ); 
    1655     } else if ( strcmp( name.prefix, SENSORS_SMSC47B397_PREFIX ) == 0 ) { 
    1656         retval = get_feat_info_smsc47b397( node, name, num ); 
    1657     } else if ( strcmp( name.prefix, SENSORS_SMSC47M1_PREFIX ) == 0 ) { 
    1658         retval = get_feat_info_smsc47m1( node, name, num ); 
    1659     } else if ( strcmp( name.prefix, SENSORS_SMSC47M192_PREFIX ) == 0 ) { 
    1660         retval = get_feat_info_smsc47m192( node, name, num ); 
    1661     } else if ( strcmp( name.prefix, SENSORS_VIA686A_PREFIX ) == 0 ) { 
    1662         retval = get_feat_info_via686a( node, name, num ); 
    1663     } else if ( strcmp( name.prefix, SENSORS_W83781D_PREFIX ) == 0 ) { 
    1664         retval = get_feat_info_w83781d( node, name, num ); 
    1665     } else if ( ( strcmp( name.prefix, SENSORS_W83782D_PREFIX ) == 0 ) || 
    1666                 ( strcmp( name.prefix, SENSORS_W83627HF_PREFIX ) == 0 ) || 
    1667                 ( strcmp( name.prefix, SENSORS_W83627THF_PREFIX ) == 0 ) || 
    1668                 ( strcmp( name.prefix, SENSORS_W83791D_PREFIX ) == 0 ) ) { 
    1669         retval = get_feat_info_w83782d( node, name, num ); 
    1670     } else if ( ( strcmp( name.prefix, SENSORS_W83627EHF_PREFIX ) == 0 ) ) { 
    1671         retval = get_feat_info_w83627ehf( node, name, num ); 
    1672     } else if ( ( strcmp( name.prefix, SENSORS_W83783S_PREFIX ) == 0 ) || 
    1673                 ( strcmp( name.prefix, SENSORS_W83697HF_PREFIX ) == 0 ) ) { 
    1674         retval = get_feat_info_w83783s( node, name, num ); 
    1675     } else if ( strcmp( name.prefix, SENSORS_AS99127F_PREFIX ) == 0 ) { 
    1676         retval = get_feat_info_as99127f( node, name, num ); 
    1677     } else if ( strcmp( name.prefix, SENSORS_K8TEMP_PREFIX ) == 0 ) { 
    1678         retval = get_feat_info_k8temp( node, name, num ); 
    1679     } else { 
    1680         g_free( node ); 
    1681         return NULL; 
     34    switch ( feature->type ) { 
     35        case SENSORS_FEATURE_IN: 
     36            node->feattype = VOLT; 
     37            break; 
     38        case SENSORS_FEATURE_TEMP: 
     39            node->feattype = TEMP; 
     40            break; 
     41        case SENSORS_FEATURE_FAN: 
     42            node->feattype = FAN; 
     43            break; 
     44        default: 
     45            g_free( node ); 
     46            return NULL; 
     47    } 
     48 
     49    node->featnum = UNDEFMAXMIN; 
     50    node->featminnum = UNDEFMAXMIN; 
     51    node->featmaxnum = UNDEFMAXMIN; 
     52    switch ( node->feattype ) { 
     53        case VOLT: 
     54            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_IN_INPUT)) ) 
     55                node->featnum = subfeature->number; 
     56            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_IN_MIN)) ) 
     57                node->featminnum = subfeature->number; 
     58            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_IN_MAX)) ) 
     59                node->featmaxnum = subfeature->number; 
     60            break; 
     61        case TEMP: 
     62            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_TEMP_INPUT)) ) 
     63                node->featnum = subfeature->number; 
     64            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_TEMP_MIN)) ) 
     65                node->featminnum = subfeature->number; 
     66            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_TEMP_MAX)) ) 
     67                node->featmaxnum = subfeature->number; 
     68            break; 
     69        case FAN: 
     70            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_FAN_INPUT)) ) 
     71                node->featnum = subfeature->number; 
     72            if ( (subfeature = sensors_get_subfeature (name, feature, SENSORS_SUBFEATURE_FAN_MIN)) ) 
     73                node->featminnum = subfeature->number; 
     74            break; 
     75    } 
     76 
     77    if ( node->featnum == UNDEFMAXMIN ) { 
     78        g_free( node ); 
     79        return NULL; 
    168280    } 
    168381     
    168482    node->name = name; 
    1685     node->darea = darea; 
    1686     node->pbar = pbar; 
    168783    node->next = NULL; 
    168884 
    168985    return node;