Skip to content

Commit

Permalink
Merge branch 'master' into drivers/phoenixcontact_modbus.c_#2710
Browse files Browse the repository at this point in the history
  • Loading branch information
jimklimov authored Dec 12, 2024
2 parents ffd4219 + 5a67745 commit aa3f955
Show file tree
Hide file tree
Showing 103 changed files with 2,908 additions and 1,078 deletions.
42 changes: 40 additions & 2 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ https://github.com/networkupstools/nut/milestone/11
a `*_s()` variant was available was not handled correctly. [PR #2583]
* A recently introduced `allow_killpower` did not actually work as an
`ups.conf` flag (only as a protocol command). [issue #2605, PR #2606]
* The ability of two copies of the driver program to talk to each other
with `upsdrvquery.c` code was not complete for the case of indefinite
`select()` wait timeout. Now `upsdrvquery_read_timeout()` fixed private
use of `struct timeval={-1,-1}` as a trigger to `select(..., NULL)`,
as logged in one part of code and not handled in the other, for the
indefinite wait [#1922, #2392, #2686, #2670]
- development iterations of NUT should now identify with not only the semantic
version of a preceding release, but with git-derived information about the
Expand Down Expand Up @@ -153,6 +159,12 @@ https://github.com/networkupstools/nut/milestone/11
models with serial port, made by NHS Sistemas Eletronicos LTDA and popular
in Brazil. Currently this driver only builds on Linux. [#2692]
- `usbhid-ups` and `netxml-ups` updated to handle "No battery installed!"
alarm also to set the `RB` (Replace Battery) value in `ups.status`.
This may cause dual triggering of notifications (as an `ALARM` generally
and as an important `REPLBATT` status in particular) in `upsmon`, but
better safe than sorry. [#415]
- usbhid-ups updates:
* Support of the `onlinedischarge_log_throttle_hovercharge` in the NUT
v2.8.2 release was found to be incomplete. [#2423, follow-up to #2215]
Expand Down Expand Up @@ -180,7 +192,7 @@ https://github.com/networkupstools/nut/milestone/11
the old behavior (if some devices do need it), while a fix is applied
by default: `powercom_sdcmd_byte_order_fallback`. [PR #2480]
* `cps-hid` subdriver now supports more variables, as available on e.g.
CP1350EPFCLCD model. [PR #2540]
CP1350EPFCLCD model, including temperature. [PRs #2540, #2711]
* USB parameters (per `usb_communication_subdriver_t`) are now set back to
their default values during enumeration after probing each subdriver.
Having an unrelated device connected with a VID:PID matching the
Expand Down Expand Up @@ -246,7 +258,7 @@ https://github.com/networkupstools/nut/milestone/11
that there is no common standard for what constitutes an alarm and such
alarm states were also previously observed for less severe reasons. This
depends on the manufacturer/device-specific implementation in the driver.
[issue #2657, PR #2658]
[issues #415, #2657, PR #2658]
* Updated documentation, end-user clients (CGI, NUT-Monitor UI);
* Updated `upsmon` client with ability to report entering and exiting
the ALARM status if reported by the driver;
Expand All @@ -261,6 +273,14 @@ https://github.com/networkupstools/nut/milestone/11
from templates). [issue #321, PR #2383]
* added an `OBLBDURATION` (seconds) setting to optionally delay raising
the alarm for immediate shutdown in critical situation. [#321]
* optimized `parse_status()` by not checking further strings if we had
a match; report unexpected tokens in debug log. [#415]
* revised internal `do_notify()` method to support formatting strings
with two `%s` placeholders, to use if certain use-cases pass any extra
information (e.g. not just "we have alarms" but their values too). [#415]
* introduced handling for "unknown" `ups.status` tokens, reporting them
as "OTHER" notification type (whenever the set of such tokens appears
or changes) or "NOTOTHER" when they disappear. [#415]
- More systemd integration:
* Introduced a `nut-sleep.service` unit which stops `nut.target` when a
Expand Down Expand Up @@ -325,6 +345,24 @@ during a NUT build.
for `bcmxcp_usb`, `richcomm_usb` and `nutdrv_atcl_usb` drivers for now
[#1763, #1764, #1768, #2580]
- all drivers should now support the optional `sdcommands` setting with
a site-local list of instant commands to handle `upsdrv_shutdown()`,
which may be useful in cases when the driver's built-in commands
(or their order) do not meet the goals of particular NUT deployment.
This can also help with shutdown endgame testing, using a mock command like
starting the beeper (where supported) to verify that the UPS communications
happen as expected, without compromising the load connected to the UPS.
+
Also defined `EF_EXIT_SUCCESS` and `EF_EXIT_FAILURE` in `include/common.h`
to avoid magic numbers in code like `set_exit_flag(-2)`, and revised whether
it is getting set at all in "killpower" vs. other cases, based on new
`handling_upsdrv_shutdown` internal flag.
+
NOTE: during this overhaul, many older drivers got their first ever supported
INSTCMD such as `shutdown.return`, `shutdown.stayoff` or `load.off`. Default
logic that was previously the content of `upsdrv_shutdown()` methods was often
relocated into new `shutdown.default` INSTCMD definitions. [#2670]
- common code:
* introduced a `NUT_DEBUG_SYSLOG` environment variable to tweak activation
of syslog message emission (and related detachment of `stderr` when
Expand Down
8 changes: 7 additions & 1 deletion UPGRADING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ Changes from 2.8.2 to 2.8.3
some alarms can contribute to unwanted/early shutdowns. For this reason
a `0|1` setting `ALARMCRITICAL` was introduced into `upsmon.conf` (default
is `1`), for such users to be able to prevent their `upsmon` from treating
the `ALARM` status as overly severe when it is not in fact. [#2658]
the `ALARM` status as overly severe when it is not in fact. [#2658, #415]
- `usbhid-ups` and `netxml-ups` updated to handle "No battery installed!"
alarm also to set the `RB` (Replace Battery) value in `ups.status`.
This may cause dual triggering of notifications (as an `ALARM` generally
and as an important `REPLBATT` status in particular) in `upsmon`, but
better safe than sorry. [#415]
- `usbhid-ups` subdriver `PowerCOM HID` subdriver sent UPS `shutdown` and
`stayoff` commands in wrong byte order, at least for devices currently
Expand Down
18 changes: 16 additions & 2 deletions clients/upscmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ static void do_cmd(char **argv, const int argc)
) {
/* reply as usual */
fprintf(stderr, "%s\n", buf);
upsdebugx(1, "%s: 'OK' only means the NUT data server accepted the request as valid, "
"but as we did not wait for result, we do not know if it was handled in fact.",
__func__);
return;
}

Expand Down Expand Up @@ -282,9 +285,20 @@ int main(int argc, char **argv)
uint16_t port;
ssize_t ret;
int have_un = 0, have_pw = 0, cmdlist = 0;
char buf[SMALLBUF * 2], username[SMALLBUF], password[SMALLBUF];
char buf[SMALLBUF * 2], username[SMALLBUF], password[SMALLBUF], *s = NULL;
const char *prog = xbasename(argv[0]);

/* NOTE: Caller must `export NUT_DEBUG_LEVEL` to see debugs for upsc
* and NUT methods called from it. This line aims to just initialize
* the subsystem, and set initial timestamp. Debugging the client is
* primarily of use to developers, so is not exposed via `-D` args.
*/
s = getenv("NUT_DEBUG_LEVEL");
if (s && str_to_int(s, &i, 10) && i > 0) {
nut_debug_level = i;
}
upsdebugx(1, "Starting NUT client: %s", prog);

while ((i = getopt(argc, argv, "+lhu:p:t:wV")) != -1) {

switch (i)
Expand Down Expand Up @@ -459,6 +473,6 @@ int main(int argc, char **argv)
/* Formal do_upsconf_args implementation to satisfy linker on AIX */
#if (defined NUT_PLATFORM_AIX)
void do_upsconf_args(char *upsname, char *var, char *val) {
fatalx(EXIT_FAILURE, "INTERNAL ERROR: formal do_upsconf_args called");
fatalx(EXIT_FAILURE, "INTERNAL ERROR: formal do_upsconf_args called");
}
#endif /* end of #if (defined NUT_PLATFORM_AIX) */
Loading

0 comments on commit aa3f955

Please sign in to comment.