|
|
c9a32a |
diff --git a/prog/sensors/main.c b/prog/sensors/main.c
|
|
|
c9a32a |
index f535b66..a19b919 100644
|
|
|
c9a32a |
--- a/prog/sensors/main.c
|
|
|
c9a32a |
+++ b/prog/sensors/main.c
|
|
|
c9a32a |
@@ -54,15 +54,16 @@ static void print_short_help(void)
|
|
|
c9a32a |
static void print_long_help(void)
|
|
|
c9a32a |
{
|
|
|
c9a32a |
printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM);
|
|
|
c9a32a |
- puts(" -c, --config-file Specify a config file\n"
|
|
|
c9a32a |
- " -h, --help Display this help text\n"
|
|
|
c9a32a |
- " -s, --set Execute `set' statements (root only)\n"
|
|
|
c9a32a |
- " -f, --fahrenheit Show temperatures in degrees fahrenheit\n"
|
|
|
c9a32a |
- " -A, --no-adapter Do not show adapter for each chip\n"
|
|
|
c9a32a |
- " --bus-list Generate bus statements for sensors.conf\n"
|
|
|
c9a32a |
- " -u Raw output\n"
|
|
|
c9a32a |
- " -j Json output\n"
|
|
|
c9a32a |
- " -v, --version Display the program version\n"
|
|
|
c9a32a |
+ puts(" -c, --config-file Specify a config file\n"
|
|
|
c9a32a |
+ " -h, --help Display this help text\n"
|
|
|
c9a32a |
+ " -s, --set Execute `set' statements (root only)\n"
|
|
|
c9a32a |
+ " -f, --fahrenheit Show temperatures in degrees fahrenheit\n"
|
|
|
c9a32a |
+ " -A, --no-adapter Do not show adapter for each chip\n"
|
|
|
c9a32a |
+ " --bus-list Generate bus statements for sensors.conf\n"
|
|
|
c9a32a |
+ " -u Raw output\n"
|
|
|
c9a32a |
+ " -j Json output\n"
|
|
|
c9a32a |
+ " -v, --version Display the program version\n"
|
|
|
c9a32a |
+ " -n, --allow-no-sensors Do not fail if no sensors found\n"
|
|
|
c9a32a |
"\n"
|
|
|
c9a32a |
"Use `-' after `-c' to read the config file from stdin.\n"
|
|
|
c9a32a |
"If no chips are specified, all chip info will be printed.\n"
|
|
|
c9a32a |
@@ -270,7 +271,7 @@ static void print_bus_list(void)
|
|
|
c9a32a |
|
|
|
c9a32a |
int main(int argc, char *argv[])
|
|
|
c9a32a |
{
|
|
|
c9a32a |
- int c, i, err, do_bus_list;
|
|
|
c9a32a |
+ int c, i, err, do_bus_list, allow_no_sensors;
|
|
|
c9a32a |
const char *config_file_name = NULL;
|
|
|
c9a32a |
|
|
|
c9a32a |
struct option long_opts[] = {
|
|
|
c9a32a |
@@ -281,6 +282,7 @@ int main(int argc, char *argv[])
|
|
|
c9a32a |
{ "no-adapter", no_argument, NULL, 'A' },
|
|
|
c9a32a |
{ "config-file", required_argument, NULL, 'c' },
|
|
|
c9a32a |
{ "bus-list", no_argument, NULL, 'B' },
|
|
|
c9a32a |
+ { "allow-no-sensors", no_argument, NULL, 'n' },
|
|
|
c9a32a |
{ 0, 0, 0, 0 }
|
|
|
c9a32a |
};
|
|
|
c9a32a |
|
|
|
c9a32a |
@@ -291,8 +293,9 @@ int main(int argc, char *argv[])
|
|
|
c9a32a |
do_sets = 0;
|
|
|
c9a32a |
do_bus_list = 0;
|
|
|
c9a32a |
hide_adapter = 0;
|
|
|
c9a32a |
+ allow_no_sensors = 0;
|
|
|
c9a32a |
while (1) {
|
|
|
c9a32a |
- c = getopt_long(argc, argv, "hsvfAc:uj", long_opts, NULL);
|
|
|
c9a32a |
+ c = getopt_long(argc, argv, "hsvfAc:ujn", long_opts, NULL);
|
|
|
c9a32a |
if (c == EOF)
|
|
|
c9a32a |
break;
|
|
|
c9a32a |
switch(c) {
|
|
|
c9a32a |
@@ -327,6 +330,9 @@ int main(int argc, char *argv[])
|
|
|
c9a32a |
case 'B':
|
|
|
c9a32a |
do_bus_list = 1;
|
|
|
c9a32a |
break;
|
|
|
c9a32a |
+ case 'n':
|
|
|
c9a32a |
+ allow_no_sensors = 1;
|
|
|
c9a32a |
+ break;
|
|
|
c9a32a |
default:
|
|
|
c9a32a |
fprintf(stderr,
|
|
|
c9a32a |
"Internal error while parsing options!\n");
|
|
|
c9a32a |
@@ -349,7 +355,9 @@ int main(int argc, char *argv[])
|
|
|
c9a32a |
"No sensors found!\n"
|
|
|
c9a32a |
"Make sure you loaded all the kernel drivers you need.\n"
|
|
|
c9a32a |
"Try sensors-detect to find out which these are.\n");
|
|
|
c9a32a |
- err = 1;
|
|
|
c9a32a |
+ if (!allow_no_sensors) {
|
|
|
c9a32a |
+ err = 1;
|
|
|
c9a32a |
+ }
|
|
|
c9a32a |
}
|
|
|
c9a32a |
} else {
|
|
|
c9a32a |
int cnt = 0;
|
|
|
c9a32a |
diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1
|
|
|
c9a32a |
index 7d66e4b..d207aa1 100644
|
|
|
c9a32a |
--- a/prog/sensors/sensors.1
|
|
|
c9a32a |
+++ b/prog/sensors/sensors.1
|
|
|
c9a32a |
@@ -78,6 +78,8 @@ are only needed if you have several chips sharing the same address on different
|
|
|
c9a32a |
buses of the same type. As bus numbers are usually not guaranteed to be stable
|
|
|
c9a32a |
over reboots, these statements let you refer to each bus by its name rather
|
|
|
c9a32a |
than numbers.
|
|
|
c9a32a |
+.IP "-n, --allow-no-sensors"
|
|
|
c9a32a |
+Do not fail if no sensors found. The error message will be printed in the log.
|
|
|
c9a32a |
.SH FILES
|
|
|
c9a32a |
.I /etc/sensors3.conf
|
|
|
c9a32a |
.br
|