Blame SOURCES/lm_sensors-3.6.0-allow_no_sensors.patch

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