pkgsrc/sysutils/ups-nut/patches/patch-drivers_libusb0.c
gdt f5ed2ef924 sysutils/ups-nut-*: Update to 2.8.0
Tested on NetBSD 9 amd64 with a UPS that's more than 4 times older
than nut 2.7.4!

Upstream NEWS:

Release notes for NUT 2.8.0 - what's new since 2.7.4:

NOTE: Earlier discussions (mailing list threads, GitHub issues, etc.) could
refer to this change set (too long in the making) as NUT 2.7.5.

 - New (optional) keywords for configuration files were added,
   so existing NUT 2.7.x builds would not accept them if some
   deployments switch versions back and forth -- due to this,
   semantically the version was bumped to NUT 2.8.x.

 - Add support for openssl-1.1.0 (Arjen de Korte)

 - libusb-1.0 API support in addition to libusb-0.1 API [#300]

 - Add support for `DISABLE_WEAK_SSL=true` in upsd.conf to disable older/weaker
   SSL/TLS protocols and ciphers: when NUT is built against relatively recent
   versions of OpenSSL or NSS it will be restricted to TLSv1.2 or better.
   For least-surprise, currently defaults to `false` and complains in log
   [PR #1043]

 - Add support for `ALLOW_NO_DEVICE=true` (as an upsd.conf flag or environment
   variable passed from caller of the program), to allow starting the data
   server initially without any device configurations and reloading it later
   to apply config changes on the fly [PR #766]

 - Add support for `debug_min=NUM` setting (ups.conf, upsd.conf, upsmon.conf)
   to specify the minimum debug verbosity for daemons. This allows "in-vivo"
   troubleshooting of service daemons without editing init scripts or service
   unit definitions.

 - Improve support for upsdrvctl for managing of numerous device configs,
   including default "maxretry=3" and a "nowait" option to complete the
   "start of everything" mode after triggering the drivers and not waiting
   for them to complete initializing. This matters on systems that monitor
   from dozens to hundreds of devices.

 - Drivers support a new value for `synchronous` setting, which is the
   new default now: `auto`.  Initially after driver start-up this mode
   acts as the older default `off`, but would fall back to `on` in case
   the driver fails to send reports to `upsd` by overflowing the socket
   buffer in async mode -- so the next connections of this driver uptime
   would be synchronized (potentially slower, but safer -- blocking on
   writes to the data server).  This adaptation would primarily impact
   and benefit devices with many (hundreds of) data points, such as
   ePDUs and daisy chains. [issue #1309, PR #1315]

 - Daemons such as upsd, upsmon, upslog, and device drivers previously
   implied that enabled debugging (or upslog to stdout) means foreground
   running, otherwise the daemon was always sent to the background.
   Now there are explicit options for this (`-F`/`-B`), although default
   behavior is retained. This change is used for simplified service unit
   definitions.

 - Improvements for device discovery or driver "lock-picking", including
   general support for:
   * "Standalone" mode (`-s` option), to monitor a device which is not
     detailed or mentioned in ups.conf
   * `NUT_ALTPIDPATH` and `NUT_STATEPATH` environment variables to override
     the paths built into the driver binary [PR #473 and #507]
   * "Driver data dump" mode (`-d` option), to poll a device for one or
     few ('update_count' ) loops, report discovered values (dump the data
     tree in upsc-like format), and exit. This complements the `nut-scanner`
     for finding and identifying devices.

 - support for new devices:
   * IBM 6000 VA LCD 4U Rack UPS; 5396-1Kx (USB)
   * Phoenix Contact QUINT-UPS model 2320461 (Modbus)
   * Tripp-Lite SU3000LCD2UHV (USB; protocol 1330)
   * Emerson Avocent PM3000 PDU (SNMP)
   * HPE ePDU (SNMP)

 - nutdrv_qx: enhanced estimation of remaining battery runtime based
   on speed of voltage drop, which varies as they age [PR #1027]

 - nutdrv_qx: several subdrivers added or improved, including:
   * "snr" subdriver with USB connection, for SNR-UPS-LID-XXXX [PR #1008].
     Note that end-users should reference explicitly the `snr` subdriver
     in their `ups.conf` settings because of USB chip using the same
     values of VendorID/ProductID as fabula_subdriver, fuji_subdriver,
     and krauler_subdriver.
   * "hunnox" subdriver, as a dialect of earlier "fabula" [PR #638]
     adds support for Hunnox HNX-850 with USB connection and reported to work
     for Powercool, Iron Guardian, ARES devices and possibly many others from
     discussions linking to the pull request which introduced the driver.
   * "phoenixtec" subdriver for Masterguard A and E series, device series
     A700/1000/2000/3000(-19) and E40/60/100(-19). [PR #975]
   * "ablerex" subdriver provided by the OEM vendor, note that it replaces
     "krauler_subdriver" as default handler for VID:PID 0xffff:0x0000
     [PR #1135]
   * Legrand HID defined and handled by "krauler_subdriver" by default
     [PR #1075, issue #616]
   * add new "armac" subdriver, tested with Armac R/2000I/PSW, but should
     support other UPSes that work with "PowerManagerII" software from
     Richcomm Technologies from around 2004-2005 [PR #1239, issue #1238]

 - microsol-apc (starting at version 0.68 as derived from solis 0.67):
   adding support for newer APC Back-UPS BR hardware, such as
   APC Back-UPS BZ1500, BZ2200BI and BZ2200I [PR #994]

 - pijuice: added new i2c bus driver for PiJuice HAT, a battery UPS module
   for the Raspberry Pi systems [PR #730]

 - huawei-ups2000: added new driver for USB (Linux 5.12+ so far) and Serial
   RS-232 Modbus device support of Huawei UPS2000/2000A (1kVA-3kVA) series,
   and possibly some related FSP UPS models. [PR #954]

 - socomec_jbus: added new driver for modbus-based JBUS protocol over serial
   RS-232 for Socomec UPS (tested with a DIGYS 3/3 15kVA model, working
   on Linux x86-64 and Raspberry Pi 3 ARM). [PR #1313]

 - adelsystem_cbi: added new driver for ADELSYSTEM CBI2801224A, an all-in-one
   12/24Vdc DC-UPS, which supports the modbus RTU communication protocol
   [PR #1282]

 - generic_modbus: added new driver for TCP and Serial Modbus device support.
   The driver has been tested against PULS UPS (model UB40.241) via
   MOXA ioLogikR1212 (RS485) and ioLogikE1212 (TCP/IP), and configuration
   allows to map custom registers and addresses to NUT events [PR #1052]

 - genericups: added support for FTTx battery backup devices, and new signal
   type mappings for the contact closure pins interpretation (RB for replace
   battery, BYPASS for disconnected battery, and "none" or NULL for signals
   to ignore) [PR #1061]

 - add devices to HCL/DDL:
   * APC Back-UPS CS (USB)
   * CPS CP1500EPFCLCD (USB)
   * CPS EC350G, EC750G (USB)
   * CPS PR2200LCDRT2U (SNMP)
   * Eaton ATS 16 and 30 (SNMP)
   * Eaton 5E2200VA (USB)
   * Eaton 9PX Split Phase 6/8/10 kVA (XML/USB/SHUT)
   * Eaton 9PX (XML/USB/SHUT)
   * Eaton Ellipse PRO 650 VA (USB)
   * Ippon Back Comfo Pro II 650/850/1050 (USB)
   * Numeric Digital 800 (USB)
   * Opti-UPS PS1500E (USB)
   * Powercool 350VA to 1600VA (USB)

 - C++11 support in nutclient library and cppunit tests

 - Added C++ testing mock for TcpClient class (nutclientmem/MemClientStub:
   data stored in local memory) [PR #1034]

 - Dual Python 2 and 3 compatibility in development scripts; ability to
   run build activities and resulting built NUT programs on systems that
   do not have a binary named "python" [PR #1115 and some before it]

 - Added Russian translation for NUT-Monitor GUI client [PR #806]

 - Separated NUT-Monitor UI into two applications, NUT-Monitor-py2gtk2 and
   NUT-Monitor-py3qt5, suitable for two generations of Python ecosystem
   with their great differences; `NUT-Monitor` name is retained for wrapper
   script which calls one of these, such that the current system can execute
   [PRs #1310, #1354]

 - Various USB driver families: expanded device-matching with "device" in
   addition to "bus" and generic USB fields. This is needed to support
   multiple attached devices that seem identical by other fields (e.g.
   same vendor, same model, same USB bus, and no serial number) [PR #974]

 - Various USB driver families: Improved HID parsing for byte-stream to
   number conversions on different CPU architectures [PR #1024]

 - Various USB HID driver families: added support for composite devices
   utilizing interface greater than 0 for the UPS interface [PR #1044]

 - usbhid-ups:
   * added generic framework for fixing Report Descriptors which can be
     used for different manufacturers by adding code to the appropriate
     subdriver rather than polluting the main code with UPS specific
     exceptions, and applied fixes for known mistakes in (some releases
     of firmware for) CyberPower CPS*EPFCLCD [issue #439, PR #1245]
   * added `onlinedischarge` option for UPSes that report `OL+DISCHRG`
     when wall power is lost [PR #811]
   * changed detection of VendorID 0x06da handling of which is claimed
     by Liebert/Phoenixtec HID historically, and MGE HID (for AEG PROTECT
     NAS UPSes) since NUT 2.7.4, so that the higher-priority MGE subdriver
     would not grab each and all of the devices exposing that ID [PR #1357]
   * CPS HID: add input.frequency and output.frequency
   * OpenUPS2: only check OEM Information string once (fewer log messages)
   * Liebert GXT4 USB VID:PID [10AF:0000]
   * add battery voltage and input/output transfer voltage and frequency
     in Liebert/Phoenixtec HID mapping, to support PowerWalker VFI 2000 TGS
     better [PR #564, issue #560]
   * add a little delay between multicommands [PR #1228]
   * fix Eaton/MGE mapping for beeper handling
   * add IBM USB VID
   * add deep battery test for CyberPower OL3000RMXL2U
   * report the libusb version used
   * fixed CPU architecture dependent bitmask math issues, causing wrong
     numbers interpreted from wire protocol data in Big-Endian LP64 builds
     (SPARC64, s390x, etc.) [issue #1023, PRs #1024, #1040, #1055, #1226]
   * add Delta UPS Amplon R Series, tested on R1K and R3K model [PR #987]
   * add Delta Minuteman UPS VID/PID [PR #1230, issues #555 and #1227]
   * add AMETEK Powervar UPM [PR #733]
   * add Tripplite AVR750U (ProductID 0x3024) [PR #963]
   * add Arduino HID device support with new arduino-hid subdriver [PR #1044]
   * add new salicru-hid subdriver, tested with Salicru SPS Home 850 VA
     [PR #1199, issue #732]
   * add new ever-hid subdriver to support EVER UPS devices (Sinline RT Series,
     Sinline RT XL Series, ECO PRO AVR CDS Series) [PR #431]
   * add ability to set `battery.mfr.date` for APC HID UPS [PR #1318]

 - usbhid-ups / mge-shut: compute a realpower output load approximation for
   Eaton UPS when the needed data is not present

 - snmp-ups:
   * APC ePDU MIB support
   * add `input.phase.shift` variable
   * add configurable write-able `ondelay` (`ups.delay.start`) and `offdelay`
     (`ups.delay.shutdown`) as timeticks support [PR #276]
   * outlet groups
   * fix the rounding / truncation of some values
   * add outlet.N.name for Eaton ePDU
   * add input.bypass.frequency for Eaton 3ph
   * fix support for Eaton 2-phase ("split phase") UPS
   * add flag to list currently loaded MIB-to-NUT mappings
   * fix input.L2.voltage on Eaton G2/G3 PDU
   * update Eaton Aphel Revelation MIB
   * support Raritan Dominion PX2 PDU
   * support Emerson Avocent PM3000 PDU
   * improve ALARM flag handling
   * add firmware version for new HPE Network card
   * add ups.load, battery.charge, input.{voltage,frequency} and output.voltage
     for CyberPower, as well as shutdown and other instant commands
   * several rounds of updates for Eaton devices, including new ATS and ePDU
     hardware families
   * fixed bit mask values for flags to surely use different numbers behind
     logical items (inevitably changing some of those macro symbols) [PR #1180]

 - snmp-ups and nut-scanner should now support more SNMPv3 Auth and Priv
   protocols, as available at NUT build time [PRs #1165, #1172]

 - nut-scanner: various improvements, including:
   * detection of libraries at runtime
   * tracing information
   * limiting parallelism (thread count) [PRs #1158, #1164]

 - nut-ipmipsu: improve FreeIPMI support to build cleanly against older and
   newer FreeIPMI versions [PR #1179]

 - the powerpanel driver now also supports CyberPower OR1500LCDRTXL2U with
   serial cable [PR #538]

 - powercom driver: implement `nobt` config parameter to skip battery check
   on initialization/startup [PR #1256]

 - netxml-ups:
   * Report calibration status
   * Fix for erroneous battery info (MGEXML/0.30) [PR #1069]

 - solis: various improvements and fixes

 - liebert-esp2: Correct battery V scaling, update docs, implement split-phase
   unit support [PR #412]

 - tripplite: the "Tripp-Lite SmartUPS driver" as tested with SMART2200NET
   learned to discover the firmware generation and some device features,
   and in particular to manage power separately on one or two outlet groups
   [PR #1048]

 - tripplite_usb: updated to recognize the "3005" protocol [PR #584]

 - libnutclient: introduce getDevicesVariableValues() to improve performances
   when querying many devices (up to 15 times faster)

 - nut-driver-enumerator: introduced a script for Linux systemd and
   Solaris/illumos SMF to inspect current NUT configuration in ups.conf
   file and generate service management instances for each currently
   tracked power device. Also introduced services to monitor the NUT
   configuration and react to editions of this file, mostly intended
   for deployments that do massive monitoring of dynamically changing
   farms of power devices.

 - Fix File descriptors leaks by upsmon and upssched (SELinux errors)

 - systemd support improvements:
   * POWEROFF_WAIT
   * reload support for upsd
   * Deliver systemd-tmpfiles config to pre-create runtime locations
     [PR #1037 for Issue #1030]
   * Update units with SyslogIdentifier=%N for better logging [PR #1054]

 - upsrw: display the variable type beside ENUM / RANGE

 - Added `PROTVER` as alias to `NETVER` to report the protocol version in use.
   Note that NUT codebase itself does not use this value and handles commands
   and reported errors individually [issue #1347]

 - Implement status tracking for instant commands (instcmd) and variables
   settings (setvar): this allows to get the actual execution status from the
   driver, and is available in libraries and upscmd / upsrw [PR #659]

 - Add support for extra parameter for instant commands, both in library and
   in upscmd

 - dummy-ups can now specify `mode` as a driver argument, and separates the
   notion of `dummy-once` (new default for `*.dev` files that do not change)
   vs. `dummy-loop` (legacy default for `*.seq` and others) [issue #1385]

 - new protocol variables:
   * `input.phase.shift`
   * `outlet.N.name`
   * `outlet.N.type`
   * `battery.voltage.cell.max`, `battery.voltage.cell.min`
   * `battery.temperature.cell.max`, `battery.temperature.cell.min`
   * `battery.status`
   * `battery.capacity.nominal`
   * `battery.date.maintenance` (and clarified purpose of `battery.date`)
   * `battery.packs.external` (and clarified purpose of `battery.packs`)
   * `experimental.*` namespace introduced [PR #1046] to facilitate
     introduction of NUT drivers and their data points for which we do
     not yet have concepts, or which the original driver contributors
     did not map well per suitable NUT standards: this allows to balance
     having those drivers available in the project vs. least surprise
     for when the explicitly experimental names are changed to something
     stable and standardized.
   * Proposed to track Date and Time values (still as "opaque strings")
     preferably in representations compatible to ISO-8601/RFC-3339 [PR #1076]
     (standards update; changes to actual codebase to be applied in the future)
   ** New routine to convert a US formatted date string "MM/DD/YYYY" to an
      ISO 8601 Calendar date "YYYY-MM-DD" was added to snmp-ups.c [PR #1078]

 - Master/Slave terminology was deprecated in favor of Primary/Secondary
   modes of `upsmon` client:
   * Respective keywords in the configuration files (`upsd.users` and
     `upsmon.conf`) are supported as backwards-compatible settings,
     but the obsoleted values are no longer documented.
   * Protocol keyword support was similarly updated, with `upsmon` now
     first trying to elevate privileges with `PRIMARY <ups>` request,
     and falling back to `MASTER <ups>` just in case it talks to an
     older build of an `upsd` server.
   * For the principle of least surprise, NUT codebase still exposes the
     `net_master()` (as handler for `MASTER` net command) in header and
     C code for the sake of existing linked binaries, and returns the
     `OK MASTER-GRANTED` line to the older client that invoked it.
   * Newly introduced `net_primary()` (as handler for `PRIMARY` net command)
     calls the exact same application logic, but returns `OK PRIMARY-GRANTED`
     line to the client.
   * Python binding updated to handle both cases, as the only found in-tree
     protocol consumer of the full-line text.
   * For more details see issue #840 and several pull requests referenced
     from it, and discussions on NUT mailing lists.

 - Build fixes:
   * In general, numerous fixes were applied to ensure portability and avoid
     warnings (fixing a number of real bugs that caused them); CI was extended
     to keep the codebase free of those types of warnings which we have got
     rid of, requiring builds to succeed cleanly in several dozen combinations
     of compiler versions, C standard revisions (C99 upwards, though on many
     OSes with GNU99+ extensions), operating systems and CPU architectures.
   * Public CI introduced to automatically test every contribution (PR) and
     resulting increment of main NUT codebase, including Travis CI and LGTM.com
     services, and a Jenkins farm on virtual hardware donated by Fosshost.org;
     this augments testing earlier provided for some branches by Buildbot.
   * Added cppunit testing with valgrind for the C++ client library
   * Make targets added for shell script syntax checks for helper and service
     scripts
   * Make targets added for spellcheck and for maintenance of the dictionary,
     including incremental spellcheck to only parse recently edited text files
   * The AsciiDoc detection has been reworked to allow NUT to be built from
     source without requiring asciidoc/a2x (using pre-built man pages from
     the distribution tarball, for instance)
   * Makefile contents rearranged for more resilient out-of-tree and in-tree
     builds beside those made from the root workspace directory
   * Makefiles are tested with GNU Make and BSD Make to ensure portable recipes
   * More use of `pkg-config` to detect dependencies at configure time, as
     well as fail-safe detection of presence of pkg-config (and its macros)
     to survive and build without it too
   * "slibtool" pedantic nuances now supported, allowing an alternative to
     GNU libtool
   * Build scripts updated to remove obsoleted calls to cleanly work with
     autoconf-2.70 releases in 2020 (also works with 2.69 which was the
     earlier release since 2012)
   * Dynamic library loading used in certain programs and use-cases improved,
     especially for 64-bit vs 32-bit builds on multiple-bitness OSes
   * Logging routines like `upsdebugx()` were refactored as macros so there
     is slightly less overhead when logging is disabled [PRs #685 and #1100]
   * Numerous classes of compilation warnings eradicated, many of those being
     potential issues with implicit data type conversions and varied numeric
     type width, signedness, string buffer size, uninitialized variables or
     structure fields; some more in progress
   * Several logical errors found and fixed during this walk over codebase.
   * Cases where compilers were overly zealous and particular code was written
     the way wit was intentionally, including some comparisons that help with
     different-bitness builds but indeed seem superfluous in a certain single
     bitness, were commented and encased in pragmas to disable the warnings
   * Basic coding style (indentations, lack of trailing white space) applied
     per developer guide, but not automatically enforced/checked yet.

 - Due to changes needed to resolve build warnings, mostly about mismatching
   data types for some variables, some structure definitions and API signatures
   of several routines had to be changed for argument types, return types,
   or both. Primarily this change concerns internal implementation details
   (may impact update of NUT forks with custom drivers using those), but a
   few changes also happened in header files installed for builds configured
   `--with-dev` and so may impact `upsclient` and `nutclient` (C++) consumers.
   At the very least, binaries for those consumers should be rebuilt to remain
   stable with NUT 2.8.0 and not mismatch int-type sizes and other arguments.

 - As usual, more bugfixes, cleanup and improvements, on both source code
   and documentation.
2022-04-26 23:28:25 +00:00

12 lines
358 B
C

$NetBSD: patch-drivers_libusb0.c,v 1.1 2022/04/26 23:28:25 gdt Exp $
--- drivers/libusb0.c.orig 2022-03-27 12:59:49.000000000 +0000
+++ drivers/libusb0.c
@@ -532,6 +532,7 @@ static int libusb_open(usb_dev_handle **
*/
static int libusb_strerror(const int ret, const char *desc)
{
+ /* \todo: Possibly change to >= */
if (ret > 0) {
return ret;
}