|
|
f5f521 |
diff -Nupur a/prog/sensors/main.c b/prog/sensors/main.c
|
|
|
f5f521 |
--- a/prog/sensors/main.c 2015-06-25 04:24:47.000000000 -0700
|
|
|
f5f521 |
+++ b/prog/sensors/main.c 2023-12-10 14:33:48.636986764 -0800
|
|
|
f5f521 |
@@ -54,14 +54,15 @@ static void print_short_help(void)
|
|
|
f5f521 |
static void print_long_help(void)
|
|
|
f5f521 |
{
|
|
|
f5f521 |
printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM);
|
|
|
f5f521 |
- puts(" -c, --config-file Specify a config file\n"
|
|
|
f5f521 |
- " -h, --help Display this help text\n"
|
|
|
f5f521 |
- " -s, --set Execute `set' statements (root only)\n"
|
|
|
f5f521 |
- " -f, --fahrenheit Show temperatures in degrees fahrenheit\n"
|
|
|
f5f521 |
- " -A, --no-adapter Do not show adapter for each chip\n"
|
|
|
f5f521 |
- " --bus-list Generate bus statements for sensors.conf\n"
|
|
|
f5f521 |
- " -u Raw output\n"
|
|
|
f5f521 |
- " -v, --version Display the program version\n"
|
|
|
f5f521 |
+ puts(" -c, --config-file Specify a config file\n"
|
|
|
f5f521 |
+ " -h, --help Display this help text\n"
|
|
|
f5f521 |
+ " -s, --set Execute `set' statements (root only)\n"
|
|
|
f5f521 |
+ " -f, --fahrenheit Show temperatures in degrees fahrenheit\n"
|
|
|
f5f521 |
+ " -A, --no-adapter Do not show adapter for each chip\n"
|
|
|
f5f521 |
+ " --bus-list Generate bus statements for sensors.conf\n"
|
|
|
f5f521 |
+ " -u Raw output\n"
|
|
|
f5f521 |
+ " -v, --version Display the program version\n"
|
|
|
f5f521 |
+ " -n, --allow-no-sensors Do not fail if no sensors found\n"
|
|
|
f5f521 |
"\n"
|
|
|
f5f521 |
"Use `-' after `-c' to read the config file from stdin.\n"
|
|
|
f5f521 |
"If no chips are specified, all chip info will be printed.\n"
|
|
|
f5f521 |
@@ -244,7 +245,7 @@ static void print_bus_list(void)
|
|
|
f5f521 |
|
|
|
f5f521 |
int main(int argc, char *argv[])
|
|
|
f5f521 |
{
|
|
|
f5f521 |
- int c, i, err, do_bus_list;
|
|
|
f5f521 |
+ int c, i, err, do_bus_list, allow_no_sensors;
|
|
|
f5f521 |
const char *config_file_name = NULL;
|
|
|
f5f521 |
|
|
|
f5f521 |
struct option long_opts[] = {
|
|
|
f5f521 |
@@ -255,6 +256,7 @@ int main(int argc, char *argv[])
|
|
|
f5f521 |
{ "no-adapter", no_argument, NULL, 'A' },
|
|
|
f5f521 |
{ "config-file", required_argument, NULL, 'c' },
|
|
|
f5f521 |
{ "bus-list", no_argument, NULL, 'B' },
|
|
|
f5f521 |
+ { "allow-no-sensors", no_argument, NULL, 'n' },
|
|
|
f5f521 |
{ 0, 0, 0, 0 }
|
|
|
f5f521 |
};
|
|
|
f5f521 |
|
|
|
f5f521 |
@@ -264,8 +266,9 @@ int main(int argc, char *argv[])
|
|
|
f5f521 |
do_sets = 0;
|
|
|
f5f521 |
do_bus_list = 0;
|
|
|
f5f521 |
hide_adapter = 0;
|
|
|
f5f521 |
+ allow_no_sensors = 0;
|
|
|
f5f521 |
while (1) {
|
|
|
f5f521 |
- c = getopt_long(argc, argv, "hsvfAc:u", long_opts, NULL);
|
|
|
f5f521 |
+ c = getopt_long(argc, argv, "hsvfAc:un", long_opts, NULL);
|
|
|
f5f521 |
if (c == EOF)
|
|
|
f5f521 |
break;
|
|
|
f5f521 |
switch(c) {
|
|
|
f5f521 |
@@ -297,6 +300,9 @@ int main(int argc, char *argv[])
|
|
|
f5f521 |
case 'B':
|
|
|
f5f521 |
do_bus_list = 1;
|
|
|
f5f521 |
break;
|
|
|
f5f521 |
+ case 'n':
|
|
|
f5f521 |
+ allow_no_sensors = 1;
|
|
|
f5f521 |
+ break;
|
|
|
f5f521 |
default:
|
|
|
f5f521 |
fprintf(stderr,
|
|
|
f5f521 |
"Internal error while parsing options!\n");
|
|
|
f5f521 |
@@ -319,7 +325,9 @@ int main(int argc, char *argv[])
|
|
|
f5f521 |
"No sensors found!\n"
|
|
|
f5f521 |
"Make sure you loaded all the kernel drivers you need.\n"
|
|
|
f5f521 |
"Try sensors-detect to find out which these are.\n");
|
|
|
f5f521 |
- err = 1;
|
|
|
f5f521 |
+ if (!allow_no_sensors) {
|
|
|
f5f521 |
+ err = 1;
|
|
|
f5f521 |
+ }
|
|
|
f5f521 |
}
|
|
|
f5f521 |
} else {
|
|
|
f5f521 |
int cnt = 0;
|
|
|
f5f521 |
diff -Nupur a/prog/sensors/sensors.1 b/prog/sensors/sensors.1
|
|
|
f5f521 |
--- a/prog/sensors/sensors.1 2023-12-10 14:20:37.394096995 -0800
|
|
|
f5f521 |
+++ b/prog/sensors/sensors.1 2023-12-10 14:24:52.572369778 -0800
|
|
|
f5f521 |
@@ -76,6 +76,8 @@ are only needed if you have several chip
|
|
|
f5f521 |
buses of the same type. As bus numbers are usually not guaranteed to be stable
|
|
|
f5f521 |
over reboots, these statements let you refer to each bus by its name rather
|
|
|
f5f521 |
than numbers.
|
|
|
f5f521 |
+.IP "-n, --allow-no-sensors"
|
|
|
f5f521 |
+Do not fail if no sensors found. The error message will be printed in the log.
|
|
|
f5f521 |
.SH FILES
|
|
|
f5f521 |
.I /etc/sensors3.conf
|
|
|
f5f521 |
.br
|
|
|
f5f521 |
diff -Nupur a/prog/init/lm_sensors.service b/prog/init/lm_sensors.service
|
|
|
f5f521 |
--- a/prog/init/lm_sensors.service 2023-12-10 14:20:37.361096957 -0800
|
|
|
f5f521 |
+++ b/prog/init/lm_sensors.service 2023-12-10 15:05:51.150333299 -0800
|
|
|
f5f521 |
@@ -6,7 +6,7 @@ EnvironmentFile=/etc/sysconfig/lm_sensor
|
|
|
f5f521 |
Type=oneshot
|
|
|
f5f521 |
RemainAfterExit=yes
|
|
|
f5f521 |
ExecStart=-/usr/libexec/lm_sensors/modprobe $BUS_MODULES $HWMON_MODULES
|
|
|
f5f521 |
-ExecStart=/usr/bin/sensors -s
|
|
|
f5f521 |
+ExecStart=/usr/libexec/lm_sensors/lm_sensors-wrapper
|
|
|
f5f521 |
ExecStop=-/usr/libexec/lm_sensors/modprobe-r $BUS_MODULES $HWMON_MODULES
|
|
|
f5f521 |
|
|
|
f5f521 |
[Install]
|