Changeset 4362

Show
Ignore:
Timestamp:
04/09/07 16:43:29 (6 years ago)
Author:
jwrdegoede
Message:

generic chip printing routine for sensors prog, by Bob Schlarmann and Luuk Kleiweg

Location:
lm-sensors/branches/lm-sensors-3.0.0/prog/sensors
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/Module.mk

    r2604 r4362  
    2828# defined value verbatim into the command-list of rules... 
    2929PROGSENSORSTARGETS := $(MODULE_DIR)/sensors 
    30 PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c 
     30PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/chips_generic.c 
    3131 
    3232# Include all dependency files. We use '.rd' to indicate this will create 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/main.c

    r4357 r4362  
    3535#include "chips.h" 
    3636#include "version.h" 
     37#include "chips_generic.h" 
    3738 
    3839#define PROGRAM "sensors" 
     
    5556sensors_chip_name chips[CHIPS_MAX]; 
    5657int chips_count=0; 
    57 int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown; 
     58int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown, do_generic; 
    5859 
    5960char degstr[5]; /* store the correct string to print degrees */ 
     
    7576  printf("  -u, --unknown         Treat chips as unknown ones (testing only)\n"); 
    7677  printf("  -v, --version         Display the program version\n"); 
     78  printf("  -g, --generic         Use generic printing routine for all chips (testing only)\n");  
    7779  printf("\n"); 
    7880  printf("Use `-' after `-c' to read the config file from stdin.\n"); 
     
    162164    /* next option accepted for compatibility, but otherwise ignored */ 
    163165    { "algorithm", no_argument, NULL, 'a' }, 
     166    { "generic", no_argument, NULL, 'g'}, 
    164167    { 0,0,0,0 } 
    165168  }; 
     
    171174  hide_adapter = 0; 
    172175  hide_unknown = 0; 
     176  do_generic = 0; 
    173177  while (1) { 
    174     c = getopt_long(argc,argv,"hsvfaAUc:u",long_opts,NULL); 
     178    c = getopt_long(argc,argv,"hsvfaAUc:ug",long_opts,NULL); 
    175179    if (c == EOF) 
    176180      break; 
     
    206210    case 'a': 
    207211      /* Ignore for compatibility */ 
     212      break; 
     213    case 'g': 
     214      do_generic = 1; 
    208215      break; 
    209216    default: 
     
    448455  if (do_unknown) 
    449456    print_unknown_chip(&name); 
     457  else if(do_generic) 
     458    print_generic_chip(&name); 
    450459  else { 
    451460    if(m->prefix == NULL) 
    452         print_unknown_chip(&name); 
     461        print_generic_chip(&name); 
    453462    else 
    454463        m->fn(&name);