mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-30 05:48:07 +00:00
generic chip printing routine for sensors prog, by Bob Schlarmann and Luuk Kleiweg
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4362 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
parent
99c2d0194c
commit
d871e17ccf
@ -27,7 +27,7 @@ PROGSENSORSMAN1FILES := $(MODULE_DIR)/sensors.1
|
||||
# Regrettably, even 'simply expanded variables' will not put their currently
|
||||
# defined value verbatim into the command-list of rules...
|
||||
PROGSENSORSTARGETS := $(MODULE_DIR)/sensors
|
||||
PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c
|
||||
PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/chips_generic.c
|
||||
|
||||
# Include all dependency files. We use '.rd' to indicate this will create
|
||||
# executables.
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "lib/error.h"
|
||||
#include "chips.h"
|
||||
#include "version.h"
|
||||
#include "chips_generic.h"
|
||||
|
||||
#define PROGRAM "sensors"
|
||||
#define VERSION LM_VERSION
|
||||
@ -54,7 +55,7 @@ static const char *sprintf_chip_name(sensors_chip_name name);
|
||||
#define CHIPS_MAX 20
|
||||
sensors_chip_name chips[CHIPS_MAX];
|
||||
int chips_count=0;
|
||||
int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown;
|
||||
int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown, do_generic;
|
||||
|
||||
char degstr[5]; /* store the correct string to print degrees */
|
||||
|
||||
@ -74,6 +75,7 @@ void print_long_help(void)
|
||||
printf(" -U, --no-unknown Do not show unknown chips\n");
|
||||
printf(" -u, --unknown Treat chips as unknown ones (testing only)\n");
|
||||
printf(" -v, --version Display the program version\n");
|
||||
printf(" -g, --generic Use generic printing routine for all chips (testing only)\n");
|
||||
printf("\n");
|
||||
printf("Use `-' after `-c' to read the config file from stdin.\n");
|
||||
printf("If no chips are specified, all chip info will be printed.\n");
|
||||
@ -161,6 +163,7 @@ int main (int argc, char *argv[])
|
||||
{ "unknown", no_argument, NULL, 'u' },
|
||||
/* next option accepted for compatibility, but otherwise ignored */
|
||||
{ "algorithm", no_argument, NULL, 'a' },
|
||||
{ "generic", no_argument, NULL, 'g'},
|
||||
{ 0,0,0,0 }
|
||||
};
|
||||
|
||||
@ -170,8 +173,9 @@ int main (int argc, char *argv[])
|
||||
do_sets = 0;
|
||||
hide_adapter = 0;
|
||||
hide_unknown = 0;
|
||||
do_generic = 0;
|
||||
while (1) {
|
||||
c = getopt_long(argc,argv,"hsvfaAUc:u",long_opts,NULL);
|
||||
c = getopt_long(argc,argv,"hsvfaAUc:ug",long_opts,NULL);
|
||||
if (c == EOF)
|
||||
break;
|
||||
switch(c) {
|
||||
@ -206,6 +210,9 @@ int main (int argc, char *argv[])
|
||||
case 'a':
|
||||
/* Ignore for compatibility */
|
||||
break;
|
||||
case 'g':
|
||||
do_generic = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Internal error while parsing options!\n");
|
||||
exit(1);
|
||||
@ -447,9 +454,11 @@ void do_a_print(sensors_chip_name name)
|
||||
}
|
||||
if (do_unknown)
|
||||
print_unknown_chip(&name);
|
||||
else if(do_generic)
|
||||
print_generic_chip(&name);
|
||||
else {
|
||||
if(m->prefix == NULL)
|
||||
print_unknown_chip(&name);
|
||||
print_generic_chip(&name);
|
||||
else
|
||||
m->fn(&name);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user