From 7a7b8854a321f6af42317925cbbca98fa712d49d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 6 Sep 2022 11:21:21 +0200 Subject: [PATCH 1/3] drivers/libhid.c: log if we hit the "paranoia check" with inconsistent Max vs Min [#1512] Signed-off-by: Jim Klimov --- drivers/libhid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/libhid.c b/drivers/libhid.c index 743d79bc2d..83ecceebce 100644 --- a/drivers/libhid.c +++ b/drivers/libhid.c @@ -821,6 +821,7 @@ static double logical_to_physical(HIDData_t *Data, long logical) if ((Data->PhyMax <= Data->PhyMin) || (Data->LogMax <= Data->LogMin)) { /* this should not really happen */ + upsdebugx(5, "Max was not greater than Min, returning logical value as is"); return (double)logical; } @@ -859,6 +860,7 @@ static long physical_to_logical(HIDData_t *Data, double physical) if ((Data->PhyMax <= Data->PhyMin) || (Data->LogMax <= Data->LogMin)) { /* this should not really happen */ + upsdebugx(5, "Max was not greater than Min, returning physical value as is"); return (long)physical; } From 6f4c1bf69f451def37b015824f92ec4a07eb81bd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 6 Sep 2022 14:14:44 +0200 Subject: [PATCH 2/3] drivers/main.c: retain "driver.parameter.override.XXX" (and ".default.XXX") for troubleshooting [#1279] Signed-off-by: Jim Klimov --- drivers/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/main.c b/drivers/main.c index 320f38bc56..91fd3beec0 100644 --- a/drivers/main.c +++ b/drivers/main.c @@ -291,13 +291,17 @@ void storeval(const char *var, char *val) * addvar() in a driver codebase. */ if (!strncasecmp(var, "override.", 9)) { + /* NOTE: No regard for VAR_SENSITIVE here */ dstate_setinfo(var+9, "%s", val); dstate_setflags(var+9, ST_FLAG_IMMUTABLE); + dparam_setinfo(var, val); return; } if (!strncasecmp(var, "default.", 8)) { + /* NOTE: No regard for VAR_SENSITIVE here */ dstate_setinfo(var+8, "%s", val); + dparam_setinfo(var, val); return; } From dd30c674f3aa8f7cecadc92f0d04cb791c764826 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 14 Sep 2022 12:03:06 +0200 Subject: [PATCH 3/3] configure.ac: comment that _GNU_SOURCE may be needed for strptime() detection Signed-off-by: Jim Klimov --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b438855634..5583a9b031 100644 --- a/configure.ac +++ b/configure.ac @@ -840,8 +840,10 @@ if (p == NULL || *p != '\0') return 1])], )]) AS_IF([test x"${ac_cv_func_strptime}" = xyes], [AC_DEFINE([HAVE_STRPTIME], 1, [defined if standard library has, and C standard allows, the strptime(s1,s2,tm) method])], - [AC_MSG_WARN([Optional C library routine strptime not found; a fallback implementation will be built in])] + [AC_MSG_WARN([Optional C library routine strptime not found; try adding _GNU_SOURCE; a fallback implementation will be built in])] ) +dnl Note: per Linux headers, this may need __USE_XOPEN (features.h) +dnl which is enabled by _XOPEN_SOURCE via _GNU_SOURCE on the platform. AM_CONDITIONAL([HAVE_STRPTIME], [test x"${ac_cv_func_strptime}" = "xyes"]) AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC,ts)],