From 3dc8382f4aecc15a9847371017544623c6cbdd6e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 Feb 2025 11:15:36 +0100 Subject: [PATCH 1/5] docs/man/sms_ser.txt: fix reference to docs/sms-brazil-protocol.txt [#2090] Signed-off-by: Jim Klimov --- docs/man/sms_ser.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/man/sms_ser.txt b/docs/man/sms_ser.txt index c5676729f1..f60c0c85a9 100644 --- a/docs/man/sms_ser.txt +++ b/docs/man/sms_ser.txt @@ -15,8 +15,8 @@ SYNOPSIS NOTE: This man page only documents the hardware-specific features of the sms_ser driver. For information about the core driver, see -linkman:nutupsdrv[8], and for the technical background check in -doc/sms-brazil-protocol.txt. +linkman:nutupsdrv[8], and for the technical background check the +`docs/sms-brazil-protocol.txt` file in NUT sources. NOTE: Given the proximity of this protocol to Megatec Qx family, this driver may later become part of `nutdrv_qx` collection. @@ -28,7 +28,8 @@ SUPPORTED HARDWARE sms_ser supports only the "sms 1phase" SMS Product, as described in the `monofasico.xml` file delivered with the device. -Other SMS protocols for their other products are not supported. +Other SMS protocols (for their other products) are not supported by +this driver. AUTHOR From c83358fbf2ecb1f1a8553c862bdf10d72d01af77 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 Feb 2025 11:18:20 +0100 Subject: [PATCH 2/5] docs/sms-brazil-protocol.txt: wrap long lines in intro paragraph [#2090] Signed-off-by: Jim Klimov --- docs/sms-brazil-protocol.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/sms-brazil-protocol.txt b/docs/sms-brazil-protocol.txt index 1093304b08..c61ebe2213 100644 --- a/docs/sms-brazil-protocol.txt +++ b/docs/sms-brazil-protocol.txt @@ -1,9 +1,14 @@ SMS Brazil Protocols ==================== -Using the PowerView as source, there is a folder, called `protocols` inside the installed directory, e.g. `"C:\Alerta24h\SMS_Power_View\resource"`. There are 4 protocol files (`monofasico.xml`, `trifasico.xml`, `upsilon.xml` and `voltronic.xml`), and one file called `verificaProtocolo.xml`. +Using the PowerView (accompanying UPS application for Windows) as source, +there is a folder, called `protocols` inside the installed directory, e.g. +`"C:\Alerta24h\SMS_Power_View\resource"`. There are 4 protocol files +(`monofasico.xml`, `trifasico.xml`, `upsilon.xml` and `voltronic.xml`), +and one file called `verificaProtocolo.xml`. -The file `verificaProtocolo.xml` has serial/USB commands to be sent, to detect the UPS device. +The file `verificaProtocolo.xml` has serial/USB commands to be sent, +to detect the UPS device. The file contents are: From a66f4849a13066362a95c924982a57795c106532 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 Feb 2025 11:23:04 +0100 Subject: [PATCH 3/5] docs/Makefile.am: EXTRA_DIST sms-brazil-protocol.txt and comment why it is not among ALL_TXT_SRC [#2090] Signed-off-by: Jim Klimov --- docs/Makefile.am | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/Makefile.am b/docs/Makefile.am index 3f93cf7fac..78914aa577 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -123,6 +123,15 @@ EXTRA_DIST += $(ALL_TXT_SRC) $(SHARED_DEPS) $(IMAGE_FILES) \ $(IMAGE_LOGO_FILES) $(IMAGE_LOGO_FILES_JENKINS_NUT) $(CABLES_IMAGES) $(NUT_SPELL_DICT) \ docinfo.xml common.xsl xhtml.xsl chunked.xsl asciidoc.txt asciidoc-vars.conf +# NOTE: ALL_TXT_SRC does not include sms-brazil-protocol.txt because it +# primarily includes samples of configuration files with a lot of Spanish +# (Brazilian) words which confuse the spell-checker. Adding them to common +# NUT_SPELL_DICT would compromise its usefulness for purely English documents. +# FIXME: Add support for custom additional dictionaries for specific document +# files, e.g. "something.txt.dict" if present? There is precedent and code in +# nut-website recipes by now... +EXTRA_DIST += sms-brazil-protocol.txt + ASCIIDOC_HTML_SINGLE = user-manual.html \ developer-guide.html \ packager-guide.html \ From c3379a1d35654ae94b788fc3b31f18c3b4c5be6d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 Feb 2025 17:51:24 +0100 Subject: [PATCH 4/5] NEWS.adoc: fix misplaced entry for baytech-rpc3nc-mib [#2779] Signed-off-by: Jim Klimov --- NEWS.adoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 4653a34e14..3a0132205d 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -273,6 +273,12 @@ https://github.com/networkupstools/nut/milestone/11 * ...should now track the fact of `assumed_LogMax` (typically when firmware encoding logic is wrong, and `-1` is resolved by parser). [#1512, #1040] + - snmp-ups updates: + * added support to monitor BayTech RPC3-NC PDUs, with `baytech-rpc3nc-mib` + serving same basic data points as were available in `baytech-mib.c`, + but checking for a different model OID subtree and different OIDs for + the device model information. [#2779] + - Introduced a new driver concept for interaction with OS-reported hardware monitoring readings. Currently instantiated as `hwmon_ina219` specifically made for Texas Instruments INA219 chip as exposed in the Linux "hwmon" @@ -745,10 +751,6 @@ https://github.com/networkupstools/nut/milestone/10 - snmp-ups driver: * added support for Eaton EMP002 sensor for ATS16 NM2 sub-driver. [#2286] * mapping table updates for apc-mib sub-driver. [#2264] - * added support to monitor BayTech RPC3-NC PDUs, with `baytech-rpc3nc-mib` - serving same basic data points as were available in `baytech-mib.c`, - but checking for a different model OID subtree and different OIDs for - the device model information. [#2779] - usbhid-ups driver: * `arduino-hid` subdriver was enhanced from "initial bare bones" experimental From ae33dfed2f634a55c435b203f3bdcdfe8181a1b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 Feb 2025 17:54:27 +0100 Subject: [PATCH 5/5] NEWS.adoc, drivers/main.c: exit_cleanup(): avoid upsnotify() at exit if CLI args were fatally useless Note also earlier change in commit d6112a3fa732f0881c3759870d51f1dad7348886 Signed-off-by: Jim Klimov --- NEWS.adoc | 5 +++++ drivers/main.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 3a0132205d..85d2346cbe 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -113,6 +113,11 @@ https://github.com/networkupstools/nut/milestone/11 now to report human-friendly text instead of internal enum codes. Follow-up to [issue #1590, PR #1777, PR #2136] + - drivers should no longer print warning messages about not-initializing the + notification subsystem because not running as a service when they are either + started explicitly to show the help message, or when their CLI arguments + are fatally wrong (no UPS name, no `port`, invalid trailing keywords...) + - drivers, `upsd`, `upsmon`: reduce "scary noise" about failure to `fopen()` the PID file (which most of the time means that no previous instance of the daemon was running to potentially conflict with), especially useless diff --git a/drivers/main.c b/drivers/main.c index 6a282b7a63..0217e5438a 100644 --- a/drivers/main.c +++ b/drivers/main.c @@ -131,6 +131,7 @@ static int nut_debug_level_protocol = -1; /* everything else */ static char *pidfn = NULL; static int help_only = 0, + cli_args_accepted = 0, dump_data = 0; /* Store the update_count requested */ #endif /* DRIVERS_MAIN_WITHOUT_MAIN */ @@ -796,7 +797,7 @@ int do_loop_shutdown_commands(const char *sdcmds, char **cmdused) { "too deeply nested, this seems to be either " "a NUT programming error or a mis-configuration " "of your 'sdcommands' setting", NUT_STRARG(upsname)); - } + } if (cmdused) { if (*cmdused) @@ -1833,6 +1834,15 @@ static void exit_cleanup(void) dstate_setinfo("driver.state", "cleanup.exit"); if (!dump_data && !help_only) { + if (!cli_args_accepted && !getenv("NUT_QUIET_INIT_UPSNOTIFY")) { + /* Default to not yelling about notification method support (or + * lack thereof) when CLI arguments did not get handled early on. + * Set envvar to cause "upsnotify_report_verbosity = 1" in + * common.c::upsnotify() (if still applicable; if already + * reported - oh well). + */ + setenv("NUT_QUIET_INIT_UPSNOTIFY", "yes", 0); + } upsnotify(NOTIFY_STATE_STOPPING, "exit_cleanup()"); } @@ -2333,6 +2343,7 @@ int main(int argc, char **argv) "Try -h for help."); } + cli_args_accepted = 1; assign_debug_level(); new_uid = get_user_pwent(user);